From a284f798f356ccb9e2c5c6dcae08c92da3b22114 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sat, 1 Feb 2020 17:22:52 +0000 Subject: Remove support for CLOCK_MONOTONIC not being defined Some older parts of QEMU's codebase assume that CLOCK_MONOTONIC might not be defined by the host OS, and have workarounds to deal with this. However, more recently (notably in commit 50290c002c045280f8d for qemu-img in mid-2019, but also much earlier in 2011 in commit 22795174a37e0 for ui/spice-display.c) we've written code that assumes CLOCK_MONOTONIC is always defined. The only host OS anybody's ever noticed this on is OSX 10.11 and earlier, which we don't support. So we can assume that all our host OSes have the #define, and we can remove some now-unnecessary ifdefs. Signed-off-by: Peter Maydell Message-Id: <20200201172252.6605-1-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/timer.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 85bc6eb00b..6a8b48b5a9 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -838,14 +838,11 @@ extern int use_rt_clock; static inline int64_t get_clock(void) { -#ifdef CLOCK_MONOTONIC if (use_rt_clock) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000LL + ts.tv_nsec; - } else -#endif - { + } else { /* XXX: using gettimeofday leads to problems if the date changes, so it should be avoided. */ return get_clock_realtime(); -- cgit v1.2.3