From 6875204c782e7c9aa5c28f96b2583fd31c50468f Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Tue, 15 Sep 2009 13:36:04 +0200 Subject: Enable host-clock-based RTC Switch RTC emulations to the new host_clock instead of vm_clock by default. This has the advantage that the emulated RTC will follow automatically the host time while it might be tuned via NTP. vm_clock can still be selected by passing '-rtc clock=vm' on the command line. Note that some RTC emulations (at least M48T59) already use the host time unconditionally while others (namely MC146818) do not. This patch introduces the required infrastructure for selecting the base clock but only converts MC146818 for now. Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori --- qemu-options.hx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'qemu-options.hx') diff --git a/qemu-options.hx b/qemu-options.hx index 586474e39b..f21e9f9da2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1500,22 +1500,28 @@ DEF("startdate", HAS_ARG, QEMU_OPTION_startdate, "") #ifdef TARGET_I386 DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \ - "-rtc [base=utc|localtime|date][,driftfix=none|slew]\n" \ - " set the RTC base, enable drift fix for clock ticks\n") + "-rtc [base=utc|localtime|date][,clock=host|vm][,driftfix=none|slew]\n" \ + " set the RTC base and clock, enable drift fix for clock ticks\n") #else DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \ - "-rtc [base=utc|localtime|date]\n" \ + "-rtc [base=utc|localtime|date][,clock=host|vm]\n" \ " set the RTC base and clock\n") #endif STEXI -@item -rtc [base=utc|localtime|@var{date}][,driftfix=none|slew] +@item -rtc [base=utc|localtime|@var{date}][,clock=host|vm][,driftfix=none|slew] Specify @option{base} as @code{utc} or @code{localtime} to let the RTC start at the current UTC or local time, respectively. @code{localtime} is required for correct date in MS-DOS or Windows. To start at a specific point in time, provide @var{date} in the format @code{2006-06-17T16:01:21} or @code{2006-06-17}. The default base is UTC. +By default the RTC is driven by the host system time. This allows to use the +RTC as accurate reference clock inside the guest, specifically if the host +time is smoothly following an accurate external reference clock, e.g. via NTP. +If you want to isolate the guest time from the host, even prevent it from +progressing during suspension, you can set @option{clock} to @code{vm} instead. + Enable @option{driftfix} (i386 targets only) if you experience time drift problems, specifically with Windows' ACPI HAL. This option will try to figure out how many timer interrupts were not processed by the Windows guest and will -- cgit v1.2.3