aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-02-01 17:22:52 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2020-02-12 16:23:01 +0100
commita284f798f356ccb9e2c5c6dcae08c92da3b22114 (patch)
tree81fb0809fbf6e0a8ef9947f0806ad5f76a32e791 /util
parente261b36810de8dfd825b6b01fff43a6bd6f2bd8d (diff)
downloadqemu-a284f798f356ccb9e2c5c6dcae08c92da3b22114.zip
qemu-a284f798f356ccb9e2c5c6dcae08c92da3b22114.tar.gz
qemu-a284f798f356ccb9e2c5c6dcae08c92da3b22114.tar.bz2
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 <peter.maydell@linaro.org> Message-Id: <20200201172252.6605-1-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-timer-common.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/util/qemu-timer-common.c b/util/qemu-timer-common.c
index 06d084d..baf3317 100644
--- a/util/qemu-timer-common.c
+++ b/util/qemu-timer-common.c
@@ -49,14 +49,11 @@ int use_rt_clock;
static void __attribute__((constructor)) init_get_clock(void)
{
+ struct timespec ts;
+
use_rt_clock = 0;
-#ifdef CLOCK_MONOTONIC
- {
- struct timespec ts;
- if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
- use_rt_clock = 1;
- }
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+ use_rt_clock = 1;
}
-#endif
}
#endif