[Rd] 1st January isn't (PR#1370)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
09 Mar 2002 03:22:14 +0100


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

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._