Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2001 18:20:49 -0700
From:      "Crist Clark" <crist.clark@globalstar.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/27399: date(1) does not do daylight conversions properly
Message-ID:  <3B032771.A3B3A9F7@globalstar.com>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B032771.A3B3A9F7>