Files
qemu/system
Thomas Huth 16df89d95f system/rtc: Fix a possible year-2038 integer overflow problem
rtc_realtime_clock_offset is initialized with:

  rtc_realtime_clock_offset = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000;

And QEMU_CLOCK_REALTIME might be based on gettimeofday() in certain
cases (see get_clock_realtime() in include/qemu/timer.h). So this
counter will exceed 32 bits in the year 2038, thus we should not
store this value in a normal integer variable. Change it to a time_t
to fix the problem.
And while we're at it, also adjust the nearby rtc_host_datetime_offset
variable to be on the safe side in the related code.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit ae84c738e4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-06-14 08:51:01 +03:00
..
2024-12-20 17:44:56 +01:00
2025-01-09 18:16:24 +01:00
2024-12-20 17:44:56 +01:00
2025-01-29 11:43:04 -03:00