From 2827a69ffebc1bd3468814247b7edd6092fcd902 Mon Sep 17 00:00:00 2001 From: qnox Date: Wed, 26 Jun 2019 17:40:37 +0200 Subject: [PATCH] fixed configuration reload --- src/libfaketime.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libfaketime.c b/src/libfaketime.c index 6997c77..9c7b089 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -2147,9 +2147,12 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp) } } + struct timespec current_ts; + DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_REALTIME, ¤t_ts)); + if (last_data_fetch > 0) { - if ((tp->tv_sec - last_data_fetch) > cache_duration) + if ((current_ts.tv_sec - last_data_fetch) > cache_duration) { cache_expired = 1; } @@ -2184,7 +2187,7 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp) snprintf(user_faked_time, BUFFERLEN, "+0"); } - last_data_fetch = tp->tv_sec; + last_data_fetch = current_ts.tv_sec; /* fake time supplied as environment variable? */ if (parse_config_file) {