summaryrefslogtreecommitdiff
path: root/hooks.h
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2017-02-16 00:53:53 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2017-02-16 00:53:53 +0200
commita148ccbd6a8b6df3e7e7e4780820ef391e6a4e17 (patch)
treeb227d0df4e94d50d2f00e235ab1d7d7be3634f89 /hooks.h
parent8ea6477a2c5bee6c5f294fd370aab31e358c04d4 (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.h13
1 files changed, 4 insertions, 9 deletions
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*