[R] as.POSIXct problem?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sat Jan 4 00:53:03 CET 2003


<ripley at stats.ox.ac.uk> writes:

> Can you supply us with details?  For the ISO C99 standard actually says
> 
> The mktime function returns the specified calendar time encoded as a value
> of type time_t. If the calendar time cannot be represented, the function
> returns the value (time_t)-1.
> 
> and that is the behaviour that R expects.  Note that POSIX specifies what
> time_t is, but ISO C does not, so I am at a loss as to how this can be
> `more compliant with the ISO C standard'.

Just do a Google groups search for "mktime glibc" and the whole mess
turns up, including some pretty irate postgresql developers...

The spec in question appears to be

http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap04.html#tag_04_14 

although that doesn't actually mention mktime(), it just talks about
the definition of "Seconds Since the Epoch". The actual definition is
in

http://www.opengroup.org/onlinepubs/007904975/functions/mktime.html

One particular piece of sillyness with mktime() is that it uses a
return value of -1 to signal error, leaving you with a problem for
1969-12-31 23:59:59 UTC if you allow extension to times before the
Epoch.

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




More information about the R-help mailing list