[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/48] vl, qapi: offset calculation in RTC_CHANGE eve
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 19/48] vl, qapi: offset calculation in RTC_CHANGE event reverted |
Date: |
Thu, 18 Oct 2018 22:31:46 +0200 |
From: Artem Pisarenko <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
qapi/misc.json | 3 ++-
vl.c | 10 +++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/qapi/misc.json b/qapi/misc.json
index 3a68af9..c85c6c8 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -3070,7 +3070,8 @@
# Emitted when the guest changes the RTC time.
#
# @offset: offset between base RTC clock (as specified by -rtc base), and
-# new RTC clock value
+# new RTC clock value. Note that value will be different depending
+# on clock chosen to drive RTC (specified by -rtc clock).
#
# Note: This event is rate-limited.
#
diff --git a/vl.c b/vl.c
index 5bb53f7..c5fffa3 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)
--
1.8.3.1
- [Qemu-devel] [PULL 09/48] target-i386: add rtc 0x70 port as coalesced_pio, (continued)
- [Qemu-devel] [PULL 09/48] target-i386: add rtc 0x70 port as coalesced_pio, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 01/48] es1370: more fixes for ADC_FRAMEADR and ADC_FRAMECNT, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 06/48] target-i386: kvm: do not initialize padding fields, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 12/48] replay: don't process events at virtual clock checkpoint, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 07/48] linux-headers: update to 4.20-rc1, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 08/48] target-i386 : add coalesced_pio API, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 11/48] target-i386: add q35 0xcf8 port as coalesced_pio, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 13/48] i386/kvm: add support for Hyper-V IPI send, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 16/48] vl: improve/fix documentation related to RTC function, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 18/48] Fixes RTC bug with base datetime shifts in clock=vm, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 19/48] vl, qapi: offset calculation in RTC_CHANGE event reverted,
Paolo Bonzini <=
- [Qemu-devel] [PULL 20/48] call HotplugHandler->plug() as the last step in device realization, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 21/48] hw: edu: drop DO_UPCAST, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 25/48] hyperv_testdev: drop unnecessary includes, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 10/48] target-i386: add i440fx 0xcf8 port as coalesced_pio, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 17/48] vl: refactor -rtc option references, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 15/48] i386: hvf: Remove hvf_disabled, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 14/48] i386: hvf: Fix register refs if REX is present, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 24/48] hyperv_testdev: refactor for better maintainability, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 23/48] scsi-disk: fix rerror/werror=ignore, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 22/48] scsi-disk: fix double completion of failing passthrough requests, Paolo Bonzini, 2018/10/18