Red Hat Bugzilla – Bug 19496
1 hour off in some DST time conversions
Last modified: 2007-04-18 12:29:26 EDT
date -d '1/1/70 UTC +86400000 seconds' -- or any number of seconds that
in a date during daylight savings time -- returns a time one hour later
than it should.
The example returns 'Tue Sep 26 21:00:00 EDT 1972', the correct answer is
which corresponds to 00:00 UTC. (86400000 seconds is exactly 1000 days).
date expressions that result in EST, the answer is correct. In other
words, EST and EDT
are reported 2 hours apart, not one hour. This problem may not be in date,
but somewhere else: I compiled date from gnu sources, and had the same
problem. Note that if using EST and not UTC for a starting point, the
problem does not appear. Also note that I'm doing this while EDT is in
effect. Compiling gnu date (same version) on AIX did not show the
problem. I have used both mktime() and localtime() in these time ranges
and am pretty sure I saw no problem. This problem also appeared in RH 5.1
when I compiled gnu date (sh-utils-1.16, again from gnu sources). As I
recall, the delivered date program in 5.1 was seriously buggy, but I may be
thinking of an earlier version. As I find your site a bit confusing, you
may already know about this, I apologise if I have missed it as I checked.
This is fixed in the current version.