summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorJ William Piggott2017-12-09 21:05:38 +0100
committerJ William Piggott2017-12-09 21:05:38 +0100
commit2d9a0b0adb509d568576ff51c6511d1eb21c8938 (patch)
tree4070de3d08442197c766f16c0142c594e7594642 /sys-utils/hwclock.c
parentlib/timeutils.c:strxxx_iso: test conversion errors (diff)
downloadkernel-qcow2-util-linux-2d9a0b0adb509d568576ff51c6511d1eb21c8938.tar.gz
kernel-qcow2-util-linux-2d9a0b0adb509d568576ff51c6511d1eb21c8938.tar.xz
kernel-qcow2-util-linux-2d9a0b0adb509d568576ff51c6511d1eb21c8938.zip
lib/timeutils.c:strxxx_iso: do not wrap tm_year
Year can wrap when adding the tm struct epoch during iso formatting: hwclock --utc --noadjfile --predict --date '67768034678844900 seconds' -2147481749-12-31 23:59:59.000000-05:00 Patched: hwclock --utc --noadjfile --predict --date '67768034678844900 seconds' 2147485547-12-31 23:59:59.000000-05:00 Comparable to date(1): date -Ins --date '67768034678844900 seconds' 2147485547-12-31T23:59:59,547886165-0500 Note: the 'seconds' argument is relative to the current time, so reaching this max year output is a moving target. The values shown above were invalid one second later. They then overflow tm_year upon conversion with localtime(3) and friends, which causes them to return NULL indicating that an error occurred. Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils/hwclock.c')
0 files changed, 0 insertions, 0 deletions