Re: [PATCH 1/6] UML - Deal with host time going backwards

From: Jeremy Fitzhardinge
Date: Wed Jun 04 2008 - 16:06:08 EST


Jeff Dike wrote:
On Wed, Jun 04, 2008 at 03:31:58PM +0100, Jeremy Fitzhardinge wrote:
Shouldn't UML use a monotonic host clock for guest timekeeping?

Indeed, Eric pointed out the posix timers, which I had forgotten
about. On the face of it, a monotonic timer should do the trick, but
it's not obvious how to get it to behave like a monotonic
gettimeofday...

You can either read the monotonic clock directly, or use it as a time source for a monotonic timer. clock_gettime(CLOCK_MONOTONIC, &ts) will return the time in ns, and you can just feed that directly into the guest as a clocksource.

J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/