From owner-freebsd-bugs Wed May 16 18:30: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1086E37B423 for ; Wed, 16 May 2001 18:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4H1U1n51686; Wed, 16 May 2001 18:30:01 -0700 (PDT) (envelope-from gnats) Received: from nsmail.corp.globalstar.com (gibraltar.globalstar.com [207.88.248.142]) by hub.freebsd.org (Postfix) with ESMTP id 157FB37B422 for ; Wed, 16 May 2001 18:20:51 -0700 (PDT) (envelope-from crist.clark@globalstar.com) Received: from globalstar.com ([207.88.153.184]) by nsmail.corp.globalstar.com (Netscape Messaging Server 4.15) with ESMTP id GDGH2400.LGC for ; Wed, 16 May 2001 18:20:28 -0700 Message-Id: <3B032771.A3B3A9F7@globalstar.com> Date: Wed, 16 May 2001 18:20:49 -0700 From: "Crist Clark" To: FreeBSD-gnats-submit@freebsd.org Subject: bin/27399: date(1) does not do daylight conversions properly Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 27399 >Category: bin >Synopsis: date(1) does not do daylight conversions properly >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 16 18:30:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Crist J. Clark >Release: FreeBSD 4.3-STABLE i386 >Organization: >Environment: System: FreeBSD sec-tools.corp.globalstar.com 4.3-STABLE FreeBSD 4.3-STABLE #0: +Mon Apr 30 10:06:50 PDT 2001 +cclark@sec-tools.corp.globalstar.com:/usr/obj/usr/src/sys/SEC-TOOLS i386 All platforms, FreeBSD STABLE, date(1) command >Description: The date(1) command does not properly deal with crossing standard-daylight time boundaries. The _current_ daylight setting is used rather than the one for the time the user provides. For example, the switch to daylight time for my timezone (Pacific US) happened on the morning of April 1st this year, $ date -j 200104010000 Sat Mar 31 23:00:00 PST 2001 $ date -j 200104020000 Mon Apr 2 00:00:00 PDT 2001 As shown, when I want date to print the time for Sun Apr 1 00:00:00 PST 2001, it actually prints the time from an hour earlier. This is not what the user would expect. Why should the current daylight setting affect anything? >How-To-Repeat: See above example. >Fix: The date(1) command should let mktime(3) figure out the daylight setting for the time it is given rather than using the current daylight setting. --- date.c.orig Sat Sep 23 04:25:12 2000 +++ date.c Wed May 16 16:44:59 2001 @@ -268,6 +268,9 @@ } } + /* Let mktime(3) out if the provided date is in daylight time */ + lt->tm_isdst = -1; + /* convert broken-down time to GMT clock time */ if ((tval = mktime(lt)) == -1) errx(1, "nonexistent time"); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message