aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorArtem Pisarenko <artem.k.pisarenko@gmail.com>2018-10-18 13:12:55 +0600
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-19 13:44:12 +0200
commitac0989f53dd08ba7831130396f794b3e3bdf2d1a (patch)
tree237a765f2dd464e678f59d3b85b2c354440a4739 /vl.c
parenteb6a52099160f1a6e66d7ee042bbf7fb5dba67d6 (diff)
vl, qapi: offset calculation in RTC_CHANGE event reverted
Return value of qemu_timedate_diff(), used for calculation offset in QAPI 'RTC_CHANGE' event, restored to keep compatibility. Since it wasn't documented that difference is relative to host clock advancement, this change also adds important note to 'RTC_CHANGE' event description to highlight established implementation specifics. Signed-off-by: Artem Pisarenko <artem.k.pisarenko@gmail.com> Message-Id: <1fc12c77e8b7115d3842919a8b586d9cbe4efca6.1539846575.git.artem.k.pisarenko@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/vl.c b/vl.c
index 5bb53f7204..c5fffa349b 100644
--- a/vl.c
+++ b/vl.c
@@ -789,10 +789,10 @@ void qemu_system_vmstop_request(RunState state)
/***********************************************************/
/* RTC reference time/date access */
-static time_t qemu_ref_timedate(void)
+static time_t qemu_ref_timedate(QEMUClockType clock)
{
- time_t value = qemu_clock_get_ms(rtc_clock) / 1000;
- switch (rtc_clock) {
+ time_t value = qemu_clock_get_ms(clock) / 1000;
+ switch (clock) {
case QEMU_CLOCK_REALTIME:
value -= rtc_realtime_clock_offset;
/* no break */
@@ -812,7 +812,7 @@ static time_t qemu_ref_timedate(void)
void qemu_get_timedate(struct tm *tm, int offset)
{
- time_t ti = qemu_ref_timedate();
+ time_t ti = qemu_ref_timedate(rtc_clock);
ti += offset;
@@ -847,7 +847,7 @@ int qemu_timedate_diff(struct tm *tm)
abort();
}
- return seconds - qemu_ref_timedate();
+ return seconds - qemu_ref_timedate(QEMU_CLOCK_HOST);
}
static void configure_rtc_base_datetime(const char *startdate)