From Paul.Hernaus@nl.origin-it.com  Mon Mar 27 07:46:34 2000
Return-Path: <Paul.Hernaus@nl.origin-it.com>
Received: from gw-nl4.philips.com (gw-nl4.philips.com [192.68.44.36])
	by hub.freebsd.org (Postfix) with ESMTP id F0AE337B5F6
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Mar 2000 07:46:30 -0800 (PST)
	(envelope-from Paul.Hernaus@nl.origin-it.com)
Received: from smtprelay-nl1.philips.com (localhost.philips.com [127.0.0.1])
          by gw-nl4.philips.com with ESMTP id RAA06838
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Mar 2000 17:46:12 +0200 (MEST)
          (envelope-from Paul.Hernaus@nl.origin-it.com)
Received: from smtprelay-eur1.philips.com(130.139.36.3) by gw-nl4.philips.com via mwrap (4.0a)
	id xma006836; Mon, 27 Mar 00 17:46:13 +0200
Received: from itchy.mpn.cp.philips.com (itchy.mpn.cp.philips.com [130.139.64.191]) 
	by smtprelay-nl1.philips.com (8.9.3/8.8.5-1.2.2m-19990317) with ESMTP id RAA01845
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Mar 2000 17:46:11 +0200 (MET DST)
Received: by itchy.mpn.cp.philips.com (Postfix, from userid 100)
	id 70ACEA8C0; Mon, 27 Mar 2000 17:46:11 +0200 (CEST)
Message-Id: <20000327154611.70ACEA8C0@itchy.mpn.cp.philips.com>
Date: Mon, 27 Mar 2000 17:46:11 +0200 (CEST)
From: Paul.Hernaus@nl.origin-it.com
Reply-To: paul@itchy.mpn.cp.philips.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: date(1) -v doesn't handle time changes (DST) correctly
X-Send-Pr-Version: 3.2

>Number:         17623
>Category:       bin
>Synopsis:       date(1) -v doesn't handle time changes (DST) correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 27 07:50:01 PST 2000
>Closed-Date:    Sat Mar 05 13:39:59 EST 2011
>Last-Modified:  Sat Mar 05 13:39:59 EST 2011
>Originator:     Paul Hernaus
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Origin
>Environment:
All FreeBSD as far as I know

>Description:

Date adjustments with -v can result in an error because Daylight Savings
Time is handled incorrectly.

>How-To-Repeat:

[~] paul@itchy> date
Mon Mar 27 17:42:55 CEST 2000
[~] paul@itchy> date -v-38H
Sun Mar 26 03:42:59 CEST 2000
[~] paul@itchy> date -v-39H
-39H: Cannot apply date adjustment
usage: date [-nu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

>Fix:
First convert the start date to UTC, then do the math, then convert
back to the desired time zone, just like GNU date does. The correct
result in this case would have been:

[~] paul@itchy> date -v-39H
Sun Mar 26 01:42:59 CET 2000

>Release-Note:
>Audit-Trail:

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).
 

From: Marc Olzheim <marcolz@stack.nl>
To: Paul Hernaus <paul@itchy.mpn.cp.philips.com>
Cc: bug-followup@FreeBSD.org, marcolz@stack.nl
Subject: Re: bin/17623: date(1) -v doesn't handle time changes (DST)
 correctly
Date: Tue, 16 Mar 2010 16:45:12 +0100

 I believe this was fixed in the set of commits of april 2000 on
 bin/date/vary.c
 
 Marc
State-Changed-From-To: open->closed 
State-Changed-By: eadler 
State-Changed-When: Sat Mar 5 13:39:58 EST 2011 
State-Changed-Why:  
seemingly fixed in r59175; I can't reproduce 

http://www.freebsd.org/cgi/query-pr.cgi?pr=17623 
>Unformatted:
