From a148ccbd6a8b6df3e7e7e4780820ef391e6a4e17 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 16 Feb 2017 00:53:53 +0200 Subject: Apply speed hack to all clocks Multiply the real clock instead of using MONOTONIC for everything. This means we track base of each clock. --- hooks.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'hooks.h') diff --git a/hooks.h b/hooks.h index e1c131e..e860ddd 100644 --- a/hooks.h +++ b/hooks.h @@ -103,15 +103,10 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp) { HOOK(clock_gettime); - - if ((clk_id == CLOCK_MONOTONIC || clk_id == CLOCK_MONOTONIC_RAW)) { - const uint64_t fake = get_fake_time_ns(); - tp->tv_sec = fake / (uint64_t)1e9; - tp->tv_nsec = (fake % (uint64_t)1e9); - return 0; - } - - return _clock_gettime(clk_id, tp); + const uint64_t fake = get_fake_time_ns(clk_id); + tp->tv_sec = fake / (uint64_t)1e9; + tp->tv_nsec = (fake % (uint64_t)1e9); + return 0; } static void* -- cgit v1.2.3