libosmocore 1.10.0.10-24ad1
Osmocom core library
|
Overriding Time: osmo_gettimeofday() More...
Functions | |
int | osmo_gettimeofday (struct timeval *tv, struct timezone *tz) |
shim around gettimeofday to be able to set the time manually. More... | |
void | osmo_gettimeofday_override_add (time_t secs, suseconds_t usecs) |
convenience function to advance the fake time. More... | |
Variables | |
bool | osmo_gettimeofday_override = false |
struct timeval | osmo_gettimeofday_override_time = { 23, 424242 } |
Overriding Time: osmo_gettimeofday()
gettimeofday()
by using a small shim osmo_gettimeofday().gettimeofday()
.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.