diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-02-28 18:28:53 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-03-01 12:33:03 +0000 |
commit | 8d827803585fd2491ec7d16a07abef999c2d42df (patch) | |
tree | c6d05e3b9b84bd01b40bee939db260e130571a6d /src | |
parent | 87fade88bd8471d0459a306255403e854122120e (diff) |
timer: Document osmo_gettimeofday API
Change-Id: I1f9e13645033c61ffaed97e457deb5e78a6bec58
Diffstat (limited to 'src')
-rw-r--r-- | src/timer_gettimeofday.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/timer_gettimeofday.c b/src/timer_gettimeofday.c index 5273a3b8..34949465 100644 --- a/src/timer_gettimeofday.c +++ b/src/timer_gettimeofday.c @@ -23,7 +23,23 @@ /*! \addtogroup timer * @{ - * \file timer_gettimeofday.c */ + * \file timer_gettimeofday.c + * Overriding Time: osmo_gettimeofday() + * - Useful to write and reproduce tests that depend on specific time + * factors. This API allows to fake the timeval provided by `gettimeofday()` + * by using a small shim osmo_gettimeofday(). + * - If the clock override is disabled (default) for a given clock, + * osmo_gettimeofday() will do the same as regular `gettimeofday()`. + * - If you want osmo_gettimeofday() to provide a specific time, you must + * enable time override by setting the global variable + * osmo_gettimeofday_override (`osmo_gettimeofday_override = true`), then + * set the global struct timeval osmo_gettimeofday_override_time wih the + * desired value. Next time osmo_gettimeofday() is called, it will return + * the values previously set. + * - A helper osmo_gettimeofday_override_add() is provided to easily + * increment osmo_gettimeofday_override_time with a specific amount of + * time. + */ #include <stdbool.h> #include <sys/time.h> |