aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-05-31 17:43:12 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-05-31 17:43:12 +0200
commitfe2be43bce7b56ec0ee4ece18c4ba0ed7cc4ad94 (patch)
treee7d48c0abddf61ab93828139cacf6c2f33359c7e
parent516a159846b9af5180698a8eebcc2a5c32a82fe5 (diff)
timespec / 1000
-rw-r--r--src/timer.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/timer.c b/src/timer.c
index fa0de441..79c42257 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -39,8 +39,16 @@
#include <osmocom/core/timer_compat.h>
#include <osmocom/core/linuxlist.h>
-static int get_time(struct timeval *now)
+int get_time(struct timeval *now)
{
+ struct timespec ts;
+
+ osmo_clock_gettime(CLOCK_MONOTONIC, &ts);
+ now = (struct timeval){
+ .tv_sec = ts.ts_sec,
+ .tv_usec = ts.ts_nsec / 1000,
+ };
+ if (ts.ts_nsec % 1000)
return osmo_gettimeofday(&now, NULL);
}