From 8e2f7e87f4d854e697c40545326a16e50614dd5c Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Sep 2016 03:58:13 +0200 Subject: add osmo_gettimeofday as a shim around gettimeofday This allows feeding a custom time for unit tests by overriding osmo_gettimeofday. Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089 --- include/osmocom/core/timer.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') 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 +#include #include #include @@ -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); + /*! @} */ -- cgit v1.2.3