delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/01/23/00:23:52

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: Av0EAEzuHE+cKEcW/2dsb2JhbABDriWBBYFyAQIEEihRAQgNIAcCLxMmAQQBGhqHYp0umlCIfoJFYwSIO4RCjhWMcw
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: Mon, 23 Jan 2012 00:23:25 -0500
Subject: RE: 1.7.9 : date command fails for year 1900
Message-ID: <0105D5C1E0353146B1B222348B0411A20A51C5679D@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 q0N5Nn4x026559

cygwin sent the following at Sunday, January 22, 2012 3:39 PM
>Thanks for corroborating my finding.

I wasn't corroborating.  You originally asked for debugging help and I
"debugged" it for you.  Except that there was no bug.  There was
"operator error".

>Does anybody else think it is odd
>that this has not been pointed out before?

No.  I think that it is odd that soemone is using date to print dates from
over a century ago.

>Why would date use signed
>long integers to hold numbers of seconds?

Because date actually is concerned with time and date.  It needs to keep
track of seconds; see the discussion of man date, below.

Why long and not long long?  Who really needs to set their clock to BC?

>You would think this problem
>would have been detected in like 1974 or so. Do I just suck it up, or is
>there a work around for this?

Yes.  Use a program intended to do what you wanted to do.

The problem is not with date, but with how you tried to use it.  The
DESCRIPTION in man date says "Display the current time in the given FORMAT,
or set the system date."  Since date is not intended to do date
arithmatic (I'm guessing that that is what you are using it for), you
shouldn't complain when it has limits.  Date arithmaitic is an extra.

If you want to do date arithmatic, use a program intended to do it.  The
one that I know of (this is not an endorsement) is dateplus, available in
C and awk versions.  But read the documentation, as it does not account
for the switch between Julian to Gregorian calendars.  And don't complain
here if you have problems with it.
<http://www.orlandokuntao.com/mf_dateplus.html>

And remember that none of these track leap seconds.

>Incidentally cal seems to figure out dates in the distant past just
>fine:

Not surprizing.  They are different programs.  And cal is tracking days,
not seconds.

/c> cal 9 1752
   September 1752
Su Mo Tu We Th Fr Sa
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Is this a bug?

(Answer: It depends on where you are.)

- 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