* [Qemu-devel] [PATCH] Allow clock_gettime() monotonic clock to be utilized on more OS's
@ 2013-04-05 0:37 Brad Smith
2013-04-05 12:51 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Brad Smith @ 2013-04-05 0:37 UTC (permalink / raw)
To: qemu-devel
Allow the clock_gettime() code using monotonic clock to be utilized on
more POSIX compliannt OS's. This started as a fix for OpenBSD which was
listed in one function as part of the previous hard coded list of OS's
for the functions to support but not in the other.
Signed-off-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 1766b2d..c363190 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -117,8 +117,7 @@ extern int use_rt_clock;
static inline int64_t get_clock(void)
{
-#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \
- || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
+#ifdef CLOCK_MONOTONIC
if (use_rt_clock) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
diff --git a/util/qemu-timer-common.c b/util/qemu-timer-common.c
index 16f5e75..95e0847 100644
--- a/util/qemu-timer-common.c
+++ b/util/qemu-timer-common.c
@@ -49,9 +49,7 @@ int use_rt_clock;
static void __attribute__((constructor)) init_get_clock(void)
{
use_rt_clock = 0;
-#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \
- || defined(__DragonFly__) || defined(__FreeBSD_kernel__) \
- || defined(__OpenBSD__)
+#ifdef CLOCK_MONOTONIC
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Allow clock_gettime() monotonic clock to be utilized on more OS's
2013-04-05 0:37 [Qemu-devel] [PATCH] Allow clock_gettime() monotonic clock to be utilized on more OS's Brad Smith
@ 2013-04-05 12:51 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2013-04-05 12:51 UTC (permalink / raw)
To: Brad Smith, qemu-devel
Applied. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-05 12:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-05 0:37 [Qemu-devel] [PATCH] Allow clock_gettime() monotonic clock to be utilized on more OS's Brad Smith
2013-04-05 12:51 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).