Skip to content

Commit

Permalink
Make sure that DONT_FAKE_MONOTONIC=1 affects all monotonic clocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mliertzer committed Jan 2, 2018
1 parent 3376334 commit 5235f6f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/libfaketime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,14 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp)
if (result == -1) return result; /* original function failed */

/* pass the real current time to our faking version, overwriting it */
if (fake_monotonic_clock || clk_id != CLOCK_MONOTONIC)
if (fake_monotonic_clock || (clk_id != CLOCK_MONOTONIC && clk_id != CLOCK_MONOTONIC_RAW
#ifdef CLOCK_MONOTONIC_COARSE
&& clk_id != CLOCK_MONOTONIC_COARSE
#endif
#ifdef CLOCK_BOOTTIME
&& clk_id != CLOCK_BOOTTIME
#endif
))
{
result = fake_clock_gettime(clk_id, tp);
}
Expand Down Expand Up @@ -2327,7 +2334,15 @@ int __clock_gettime(clockid_t clk_id, struct timespec *tp)
if (result == -1) return result; /* original function failed */

/* pass the real current time to our faking version, overwriting it */
if (fake_monotonic_clock || clk_id != CLOCK_MONOTONIC)
if (fake_monotonic_clock || (clk_id != CLOCK_MONOTONIC && clk_id != CLOCK_MONOTONIC_RAW
#ifdef CLOCK_MONOTONIC_COARSE
&& clk_id != CLOCK_MONOTONIC_COARSE
#endif
#ifdef CLOCK_BOOTTIME
&& clk_id != CLOCK_BOOTTIME
#endif
))

{
result = fake_clock_gettime(clk_id, tp);
}
Expand Down

0 comments on commit 5235f6f

Please sign in to comment.