aboutsummaryrefslogtreecommitdiffstats
path: root/src/logging.c
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 /src/logging.c
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 'src/logging.c')
-rw-r--r--src/logging.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/logging.c b/src/logging.c
index 8a101337..9e30d5f8 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -44,6 +44,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/logging.h>
+#include <osmocom/core/timer.h>
#include <osmocom/vty/logging.h> /* for LOGGING_STR. */
@@ -268,7 +269,7 @@ static void _output(struct log_target *target, unsigned int subsys,
if (target->print_ext_timestamp) {
struct tm tm;
struct timeval tv;
- gettimeofday(&tv, NULL);
+ osmo_gettimeofday(&tv, NULL);
localtime_r(&tv.tv_sec, &tm);
ret = snprintf(buf + offset, rem, "%04d%02d%02d%02d%02d%02d%03d ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,