goldfish_rtc: Fix handling a local time RTC
The default QEMU config is to have the RTC in UTC. However, if run with
-rtc base=localtime (and wall_cmos_clock is set to match), the driver
fails to account for adjkerntz due to the use of CLOCKF_SETTIME_NO_ADJ.
Copy the same code used by other CLOCKF_SETTIME_NO_ADJ-using drivers
to fix this, namely manually subtracting utc_offset().
Fixes: d63a631e72
("Add Goldfish RTC device driver for RISC-V")
MFC after: 1 week
This commit is contained in:
parent
9f678cfcb4
commit
762dcf1064
@ -151,6 +151,11 @@ goldfish_rtc_settime(device_t dev, struct timespec *ts)
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
/*
|
||||
* We request a timespec with no resolution-adjustment. That also
|
||||
* disables utc adjustment, so apply that ourselves.
|
||||
*/
|
||||
ts->tv_sec -= utc_offset();
|
||||
nsec = (uint64_t)ts->tv_sec * 1000000000 + ts->tv_nsec;
|
||||
|
||||
mtx_lock(&sc->mtx);
|
||||
|
Loading…
Reference in New Issue
Block a user