From crist.clark@globalstar.com  Wed May 16 18:20:51 2001
Return-Path: <crist.clark@globalstar.com>
Received: from nsmail.corp.globalstar.com (gibraltar.globalstar.com [207.88.248.142])
	by hub.freebsd.org (Postfix) with ESMTP id 157FB37B422
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>;
          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" <crist.clark@globalstar.com>
To: FreeBSD-gnats-submit@freebsd.org
Subject: date(1) does not do daylight conversions properly

>Number:         27399
>Category:       bin
>Synopsis:       date(1) does not do daylight conversions properly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 16 18:30:00 PDT 2001
>Closed-Date:    Sun May 20 04:45:58 PDT 2001
>Last-Modified:  Sun May 20 04:46:16 PDT 2001
>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:
State-Changed-From-To: open->analyzed 
State-Changed-By: ru 
State-Changed-When: Thu May 17 08:20:22 PDT 2001 
State-Changed-Why:  
Committed into -CURRENT, thanks! 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Thu May 17 08:20:22 PDT 2001 
Responsible-Changed-Why:  
I'll MFC shortly. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27399 
State-Changed-From-To: analyzed->closed 
State-Changed-By: ru 
State-Changed-When: Sun May 20 04:45:58 PDT 2001 
State-Changed-Why:  
MFC'ed. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27399 
>Unformatted:
