aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-22 03:58:13 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-22 07:18:39 +0200
commit8e2f7e87f4d854e697c40545326a16e50614dd5c (patch)
tree4474fbe1c0fa0262167b980227efe0c7280f9280 /include
parent13a8fb84f0d83f23e65daa528f2f392ec3b83a75 (diff)
add osmo_gettimeofday as a shim around gettimeofday
This allows feeding a custom time for unit tests by overriding osmo_gettimeofday. Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/timer.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/osmocom/core/timer.h b/include/osmocom/core/timer.h
index 6730bfe1..dbda13f2 100644
--- a/include/osmocom/core/timer.h
+++ b/include/osmocom/core/timer.h
@@ -29,6 +29,7 @@
#pragma once
#include <sys/time.h>
+#include <stdbool.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/linuxrbtree.h>
@@ -83,4 +84,14 @@ void osmo_timers_prepare(void);
int osmo_timers_update(void);
int osmo_timers_check(void);
+int osmo_gettimeofday(struct timeval *tv, struct timezone *tz);
+
+/**
+ * timer override
+ */
+
+extern bool osmo_gettimeofday_override;
+extern struct timeval osmo_gettimeofday_override_time;
+void osmo_gettimeofday_override_add(time_t secs, suseconds_t usecs);
+
/*! @} */