Received: from eggs.gnu.org ([208.118.235.92]:43743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNufa-0001KM-TF for qemu-devel@nongnu.org; Thu, 04 Apr 2013 20:38:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNufV-0000vf-WE for qemu-devel@nongnu.org; Thu, 04 Apr 2013 20:38:18 -0400 Received: from speedy.comstyle.com ([2001:470:1d:8c::2]:3717 helo=mail.comstyle.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNufV-0000tC-Rw for qemu-devel@nongnu.org; Thu, 04 Apr 2013 20:38:13 -0400 Received: from rox.home.comstyle.com (unknown [IPv6:2001:470:b01e:3:9cf8:c543:f1e9:d4d]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id 1A9033FED9 for ; Thu, 4 Apr 2013 20:37:55 -0400 (EDT) Date: Thu, 4 Apr 2013 20:37:53 -0400 From: Brad Smith Message-ID: <20130405003748.GH884@rox.home.comstyle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Allow clock_gettime() monotonic clock to be utilized on more OS's List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 Reviewed-by: Paolo Bonzini 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.