From owner-freebsd-bugs Sat Oct 26 13:50: 7 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A7FF237B401 for ; Sat, 26 Oct 2002 13:50:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5F95943E65 for ; Sat, 26 Oct 2002 13:50:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g9QKo5x3008257 for ; Sat, 26 Oct 2002 13:50:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g9QKo5Cn008254; Sat, 26 Oct 2002 13:50:05 -0700 (PDT) Date: Sat, 26 Oct 2002 13:50:05 -0700 (PDT) Message-Id: <200210262050.g9QKo5Cn008254@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Gil Kloepfer Subject: Re: bin/17623: date(1) -v doesn't handle time changes (DST) correctly Reply-To: Gil Kloepfer Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/17623; it has been noted by GNATS. From: Gil Kloepfer 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