path: root/qemu-timer.h
authorJan Kiszka <[email protected]>2009-09-15 11:36:04 (GMT)
committer Anthony Liguori <[email protected]>2009-10-05 14:32:45 (GMT)
commit21d5d12bb0ad4de7cc92a7a2d018e7ec0f9fd148 (patch) (side-by-side diff)
tree3297270a5b65d8d59d8e114d7fe3105e1330dffa /qemu-timer.h
parentf64382bad849a16208d30988ef28d5e7375099da (diff)
Despite its name QEMU_CLOCK_REALTIME is (normally) not using CLOCK_REALTIME / the host system time as base. In order to allow also non-trivial RTC emulations (MC146818) to follow the host time instead of the virtual guest time, introduce the new clock type QEMU_CLOCK_HOST. It is unconditionally based on CLOCK_REALTIME, thus will follow system time changes of the host. The only limitation of its current implementation is that pending host_clock timers may not fire early if the host time is pushed forward beyond their expiry. So far no urgent need to overcome this limitation was identified, so it's left as simple as it is (expiry on next alarm timer tick). Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Anthony Liguori <[email protected]>
Diffstat (limited to 'qemu-timer.h') (more/less context) (ignore whitespace changes)
1 files changed, 7 insertions, 0 deletions
diff --git a/qemu-timer.h b/qemu-timer.h
index e44c334..e7eaa04 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -17,6 +17,13 @@ extern QEMUClock *rt_clock;
precision clock, usually cpu cycles (use ticks_per_sec). */
extern QEMUClock *vm_clock;
+/* The host clock should be use for device models that emulate accurate
+ real time sources. It will continue to run when the virtual machine
+ is suspended, and it will reflect system time changes the host may
+ undergo (e.g. due to NTP). The host clock has the same precision as
+ the virtual clock. */
+extern QEMUClock *host_clock;
int64_t qemu_get_clock(QEMUClock *clock);
QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);