]> git.proxmox.com Git - mirror_qemu.git/commit
rtc: fix overflow in mktimegm
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Oct 2012 12:22:06 +0000 (14:22 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 5 Oct 2012 13:02:30 +0000 (08:02 -0500)
commitb6db4aca20e9af4f62c9c9e08b9b9672a6ed3390
treec720251bf1c6e4aa90b391fe80f8a7fb8b280792
parente0fea6b1e4df2067a51e08e67a17cb98a547287c
rtc: fix overflow in mktimegm

When setting a date in 1980, Linux is actually disregarding the century
byte and setting the year to 2080.  This causes a year-2038 overflow
in mktimegm.  Fix this by doing the days-to-seconds computation in
64-bit math.

Reported-by: Lucas Meneghel Rodrigues <lookkas@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cutils.c
tests/rtc-test.c