[R] as.POSIXct problem?

Suchandra Thapa s-thapa-11 at alumni.uchicago.edu
Sat Jan 4 01:00:04 CET 2003


On Fri, 2003-01-03 at 13:52, ripley at stats.ox.ac.uk wrote:
    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'.
    
There was a discussion of the problem and possible workarounds on the
postgresql-hackers list.  If you do a search for glibc and mktime on
the  postgresql developer's website or use the following link
http://archives.postgresql.org/search.php?ps=10&q=glibc+mktime&ps=10&wm=wrd&o=0&ul=%2Fpgsql-hackers%2F&m=all&wf=222211&cat=
then you should be able to read the discussion.  The short of it seemed
to have been to document the problem and try to fix the problem in next
release.

Also there is a related bug report in redhat's bug database
(bugzilla.redhat.com) as bug 65227.  

The relevant section in the IEEE standard is
http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap04.html#tag_04_14
Basically, it defines the seconds since the epoch as being undefined
before 1970.  Since mktime returns the calendar time, the glibc
maintainers seem to have decided to change the return value for dates
earlier than 1970.

-- 
------------------------------------------------------------------

Suchandra S. Thapa 
s-thapa-11 at alumni.uchicago.edu

------------------------------------------------------------------




More information about the R-help mailing list