This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/7015
timer: Document osmo_gettimeofday API
Change-Id: I1f9e13645033c61ffaed97e457deb5e78a6bec58
---
M src/timer_gettimeofday.c
1 file changed, 17 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/15/7015/1
diff --git a/src/timer_gettimeofday.c b/src/timer_gettimeofday.c
index 5273a3b..3494946 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>
--
To view, visit https://gerrit.osmocom.org/7015
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f9e13645033c61ffaed97e457deb5e78a6bec58
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>