delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/30/00:49:23

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: RE: date function: daylight savings
Date: Thu, 29 Sep 2005 22:49:05 -0600
Message-ID: <3C46C4ED0F9B944690547357EB7F1C0F04A509@COFORTCOL2S304.agwest.one.usda.gov>
From: "Pagano, Tom - Portland, OR" <tom DOT pagano AT por DOT usda DOT gov>
To: "Eric Blake" <ebb9 AT byu DOT net>
Cc: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id j8U4nLZI009522

 
I see, so the issue is whether "1 day" is defined as 24 hours or the same hour/minute/second on the previous day. 
 
And this would apply to things on the front end of the season like 
 
$ date -d "2001-04-01 -1 day"
Sat Mar 31 00:00:00 PST 2001
$ date -d "2001-04-02 -2 day"
Fri Mar 30 23:00:00 PST 2001
 
as well. My workaround since I don't need the hours (just the year, month, day) might be to set the time to noon instead of midnight. 
 
$ date -d "12:00:00 2001-04-01 -1 day"
Sat Mar 31 11:00:00 PST 2001
$ date -d "12:00:00 2001-04-02 -2 day"
Sat Mar 31 11:00:00 PST 2001
 
Good info, lightning response, thanks. 
 
Tom
 

	-----Original Message----- 
	From: Eric Blake [mailto:ebb9 AT byu DOT net] 
	Sent: Thu 9/29/2005 9:49 PM 
	To: Pagano, Tom - Portland, OR 
	Cc: cygwin AT cygwin DOT com 
	Subject: Re: date function: how many days in october are there?
	
	

	-----BEGIN PGP SIGNED MESSAGE-----
	Hash: SHA1
	
	According to Pagano, Tom - Portland, OR on 9/29/2005 9:41 PM:
	> I've noticed that the date function does something strange trying to access October 31st in a statement like
	> 
	> $ date -d "1970-10-01 +1 month -1 day"
	> as opposed to something like
	> $ date -d "1970-11-01 -1 day"
	> which (I think??) should be functionally equivalent. The actual results of the 2nd are obviously preferrable to the 1st... but I do note something squirrly going on with the hours in both (daylight savings time?)
	
	Indeed it is daylight savings.  date has no cygwin-specific patches, but
	the brand new coreutils 5.90 has been released upstream that has some
	patches in date parsing.  Once I can get that packaged, you may want to
	rerun your tests - if the bug is still present at that time, then report
	it upstream.
	
	- --
	Life is short - so eat dessert first!
	
	Eric Blake             ebb9 AT byu DOT net
	volunteer cygwin coreutils maintainer
	-----BEGIN PGP SIGNATURE-----
	Version: GnuPG v1.4.1 (Cygwin)
	Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
	Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
	
	iD8DBQFDPLW084KuGfSFAYARAso1AJ4ia3ivMy0zj2hSJFqHJp6wK3ZwSgCg0wKD
	2rBt20yYxwrSG1sxLaqbTHU=
	=0bxZ
	-----END PGP SIGNATURE-----
	


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019