From 47031405f55d8c58b964a8c8b79aa169d309eb63 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 12 Dec 2018 17:06:06 +0100 Subject: [PATCH] Timeval: Move to osmo_clock_gettime Change-Id: I24da3e1136c5396062662be1d10b07b4d97cfc2e --- CommonLibs/Timeval.cpp | 9 +++++++++ CommonLibs/Timeval.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CommonLibs/Timeval.cpp b/CommonLibs/Timeval.cpp index 21072fc7..fd1bcda7 100644 --- a/CommonLibs/Timeval.cpp +++ b/CommonLibs/Timeval.cpp @@ -27,8 +27,17 @@ #include "Timeval.h" +extern "C" { +#include +} + using namespace std; +void Timeval::now() +{ + osmo_clock_gettime(CLOCK_REALTIME, &mTimespec); +} + void Timeval::future(unsigned offset) { now(); diff --git a/CommonLibs/Timeval.h b/CommonLibs/Timeval.h index b780af12..7c6a6f69 100644 --- a/CommonLibs/Timeval.h +++ b/CommonLibs/Timeval.h @@ -47,7 +47,7 @@ class Timeval { public: /** Set the value to current time. */ - void now() { clock_gettime(CLOCK_REALTIME, &mTimespec); } + void now(); /** Set the value to gettimeofday plus an offset. */ void future(unsigned ms);