From ripley@stats.ox.ac.uk  Sat Mar  9 08:43:24 2002
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Sat, 9 Mar 2002 08:43:24 +0000 (GMT)
Subject: [Rd] 1st January isn't (PR#1370)
In-Reply-To: <x23czatr8p.fsf@blueberry.kubism.ku.dk>
Message-ID: <Pine.GSO.4.44.0203090840590.13515-100000@auk.stats>

On 9 Mar 2002, Peter Dalgaard BSA wrote:

> tlumley@u.washington.edu writes:
>
> > In today's pre1.5.0
> >
> > > ISOdate(2002,1,1)
> > [1] "2002-03-01 04:00:00 PST"
> >
> > > ISOdate(2002,1,1)==ISOdate(2002,3,1)
> > [1] TRUE
> >
> > It doesn't seem to happen for days other than 1/1
> >
> > 	-thomas
>
> Confirmed. I don't see how it could have happened from anything
> other than this change
>
> diff -u -r1.16 -r1.17
> --- src/main/datetime.c 31 Oct 2001 13:35:39 -0000      1.16
> +++ src/main/datetime.c 6 Mar 2002 11:27:37 -0000       1.17
> @@ -674,6 +674,10 @@
>             !strptime(CHAR(STRING_ELT(x, i%n)),
>                       CHAR(STRING_ELT(sformat, i%m)), &tm);
>         if(!invalid) {
> +           /* Solaris sets missing fields to 0: but that's a valid year */
> +           if(tm.tm_mday == 0) tm.tm_mday = NA_INTEGER;
> +           if(tm.tm_yday == 0) tm.tm_yday = NA_INTEGER;
> +           if(tm.tm_mon == 0) tm.tm_mon = NA_INTEGER;
>             if(tm.tm_mon == NA_INTEGER || tm.tm_mday == NA_INTEGER
>                || tm.tm_year == NA_INTEGER)
>                 glibc_fix(&tm, &invalid);
>
> I don't see how that could cause it either, though....

It can.  Unfortunately the Solaris man page is incorrect.  mon runs from 0
to 11, hence the fix is incorrect.

Fixed again.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] 1st January isn't (PR#1370)
Prof Brian D Ripley