diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2017-02-16 00:53:53 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2017-02-16 00:53:53 +0200 |
commit | a148ccbd6a8b6df3e7e7e4780820ef391e6a4e17 (patch) | |
tree | b227d0df4e94d50d2f00e235ab1d7d7be3634f89 /hooks.h | |
parent | 8ea6477a2c5bee6c5f294fd370aab31e358c04d4 (diff) |
Apply speed hack to all clocks
Multiply the real clock instead of using MONOTONIC for everything.
This means we track base of each clock.
Diffstat (limited to 'hooks.h')
-rw-r--r-- | hooks.h | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -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* |