From: Paolo Bonzini <pbonzini@redhat.com>
To: Tristan Gingold <gingold@adacore.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] Autodetect clock_gettime
Date: Tue, 15 Mar 2011 14:34:27 +0100 [thread overview]
Message-ID: <4D7F6AE3.7020301@redhat.com> (raw)
In-Reply-To: <1300195001-51765-1-git-send-email-gingold@adacore.com>
On 03/15/2011 02:16 PM, Tristan Gingold wrote:
> Some POSIX OSes (such as Darwin) doesn't have clock_gettime. This patch
> falls back on gettimeofday if clock_gettime is not available.
This may be okay as a stopgap measure, but any sane porting target for
QEMU should have a monotonic clock. In fact, Darwin has it.
http://www.wand.net.nz/~smr26/wordpress/2009/01/19/monotonic-time-in-mac-os-x/
hints that code such as the following should work and return nanoseconds:
#import <mach/mach_time.h>
uint64_t t = mach_absolute_time();
static mach_timebase_info_data_t info;
if (info.denom == 0) {
mach_timebase_info(&info);
}
return muldiv64(t, info.numer, info.denom);
Paolo
next prev parent reply other threads:[~2011-03-15 13:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-15 13:16 [Qemu-devel] [PATCH] Autodetect clock_gettime Tristan Gingold
2011-03-15 13:34 ` Paolo Bonzini [this message]
2011-03-15 13:47 ` [Qemu-devel] " Tristan Gingold
2011-03-15 13:58 ` Paolo Bonzini
2011-03-15 14:17 ` Tristan Gingold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D7F6AE3.7020301@redhat.com \
--to=pbonzini@redhat.com \
--cc=gingold@adacore.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).