Date: Sat, 26 Oct 2002 13:50:05 -0700 (PDT) From: Gil Kloepfer <gil@arlut.utexas.edu> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/17623: date(1) -v doesn't handle time changes (DST) correctly Message-ID: <200210262050.g9QKo5Cn008254@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/17623; it has been noted by GNATS. From: Gil Kloepfer <gil@arlut.utexas.edu> To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/17623: date(1) -v doesn't handle time changes (DST) correctly Date: Sat, 26 Oct 2002 15:47:47 -0500 Additional information: The documentation for the date command is also wrong because of this bug. It says: When a date is adjusted to a specific value or in units greater than hours, daylight savings time considerations are ignored. Adjustments in units of hours or less honor daylight saving time. So, assuming the current date is March 26, 0:30 and that the DST adjustment means that the clock goes forward at 01:00 to 02:00, using -v +1H will adjust the date to March 26, 2:30. Likewise, if the date is October 29, 0:30 and the DST adjustment means that the clock goes back at 02:00 to 01:00, using -v +3H will be nec- essary to reach October 29, 2:30. Looking at the code, it is obvious why the above is not the case. Hours are modified in the tm structure from localtime, instead of using the seconds-since-epoch and then converting it to printable time (as the bug originator pointed out). Another example of this bug in action: csdlap3$ date ; date -v+16H Sat Oct 26 15:44:58 CDT 2002 Sun Oct 27 07:44:58 CST 2002 This is also wrong (the second time should be 06:44:58 CST). To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210262050.g9QKo5Cn008254>