@@ -188,4 +188,15 @@ void configure_rtc(QemuOpts *opts)
exit(1);
}
}
+ value = qemu_opt_get(opts, "time-dilation");
+ if (value) {
+ if (qemu_strtod_finite(value, NULL, &clock_time_dilation)) {
+ error_report("invalid time-dilation factor '%s'", value);
+ exit(1);
+ }
+ if (clock_time_dilation <= 0.0f) {
+ error_report("time-dilation factor must be strictly positive");
+ exit(1);
+ }
+ }
}
@@ -243,6 +243,9 @@ static QemuOptsList qemu_rtc_opts = {
},{
.name = "driftfix",
.type = QEMU_OPT_STRING,
+ },{
+ .name = "time-dilation",
+ .type = QEMU_OPT_STRING,
},
{ /* end of list */ }
},
@@ -4887,7 +4887,7 @@ SRST
ERST
DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \
- "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \
+ "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew][,time-dilation=value]\n" \
" set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n",
QEMU_ARCH_ALL)
@@ -4916,6 +4916,11 @@ SRST
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 re-inject them.
+
+ It's possible to slow or accelerate time using ``time-dilation``,
+ which is a factor (real number) applied to QEMU clock. A value of 0.1 will
+ slow time by a factor of 10, and a value of 10 will accelerate it with the
+ same factor.
ERST
DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
This option sets a factor on time spent for QEMU clocks since the beginning of execution. It can be used to slow or accelerate time for a guest, without impacting QEMU speed. Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- system/rtc.c | 11 +++++++++++ system/vl.c | 3 +++ qemu-options.hx | 7 ++++++- 3 files changed, 20 insertions(+), 1 deletion(-)