aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CommonLibs/Timeval.cpp9
-rw-r--r--CommonLibs/Timeval.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/CommonLibs/Timeval.cpp b/CommonLibs/Timeval.cpp
index 21072fc..fd1bcda 100644
--- a/CommonLibs/Timeval.cpp
+++ b/CommonLibs/Timeval.cpp
@@ -27,8 +27,17 @@
#include "Timeval.h"
+extern "C" {
+#include <osmocom/core/timer.h>
+}
+
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 b780af1..7c6a6f6 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);