From d17bb114c672e605f57113317fd83e9fd7aac3d8 Mon Sep 17 00:00:00 2001 From: Wolfgang Hommel Date: Sun, 4 Jun 2023 13:21:09 +0200 Subject: [PATCH] Honor fake_monotoic_clock setting in clock_nanosleep, addresses #426 --- src/libfaketime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libfaketime.c b/src/libfaketime.c index b83bae4..fc4306d 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -1358,7 +1358,9 @@ int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, s } else if (clock_id == CLOCK_MONOTONIC) { - timespecadd(&ftpl_starttime.mon, &tdiff, &real_req); + if (fake_monotonic_clock) { + timespecadd(&ftpl_starttime.mon, &tdiff, &real_req); + } } else /* presumably only CLOCK_PROCESS_CPUTIME_ID, leave untouched */ {