delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/01/24/18:54:40

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-IronPortListener: Outbound_SMTP
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av0EAMxDH0+cKEdK/2dsb2JhbABCrjWBBYFyAQIEEihRAQgNJwIvEyYBBAEaGodinRybBIkCEAwIAgEfDwWCSgkMNVCCbGMEiD+EQ44TjHQ
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>, cygwin <cygwin AT overbearing DOT org>
Date: Tue, 24 Jan 2012 18:51:45 -0500
Subject: RE: 1.7.9 : date command fails for year 1900
Message-ID: <0105D5C1E0353146B1B222348B0411A20A51A74322@NIHMLBX02.nih.gov>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q0ONsbeT022012

cygwin sent the following at Tuesday, January 24, 2012 5:00 AM
>I want to thank everybody that responded. It looks like you don't think
>this is a bug. Given that date seems to work as I expect on SL 6.0, I
>would like to make a feature request: "Fix the date command to actually
>respond with the date"

Again, what you are asking is not simple, because time and calendars are
complicated.  How does one handle leap seconds (which occur irregularly)?
How does one handle location-dependent changes between calendars (e.g.,
Julian to Gregorian), and changes in when the year starts (not always
January 1)?  There was no 2011-12-31 in Samoa and Tokelau because they
switched which side of the International Date Line they were on.  See
<http://en.wikipedia.org/wiki/Old_Style_and_New_Style_dates#Possible_date_conflicts>
for more.

Here's an experiment.  (Note:  I don't have a Linux box so have not tried
this.)  Go to your SL 6.0 box and use date to find out the day 500 years
ago.  (This should put you earlier than the adoption of the Gregorian
calendar anywhere.)

$ date -d '500 years ago'

Now use cal to get a calendar of that month.  Do days of the week
correspond?

Another experiment on your SL box:

$ date -d 1752-09-10

This should give an error message, since (in Britain and its
Dependencies) this date did not exist.  Does it?

$ date -d 1900-02-29

This date didn't exist in the Gregorian calendar.  (No leap year in years
divisible by 100 unless they are also divisible by 400.)  Did date give an
error?

As I wrote earlier, you are using date to do something that it was never
intended to do.  You should seriously consider getting a tool designed to
do what you want.  Also, depending on how far you go back and where you
are interested in, human intervention maybe required.

>Big Props to all you guys that make this software possible and help out
>users like me.

Ditto.

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


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