[R] as.POSIXct problem -- summary

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Jan 6 12:34:02 CET 2003

A summary on this:

1) RedHat 8.0 contains an unreleased version of glibc between the released
versions 2.2.5 and 2.3.  That version (and >=2.3) have been modified to
make dates prior to 1970-01-01 invalid in some cases but not others.

We've put a workaround for this in R 1.6.2 (due on Friday), and that
checks at run-time for the broken version of glibc.  Because of the
internal inconsistencies in glibc, you will see inconsistencies in the
reporting of DST prior to 1970 (but as POSIXct times they are always

This makes it important for users of RH8.0 and other recent Linux distros
to update to 1.6.2 when released (or even R-patched now).  We used a
run-time test to allow for installations which are updated to a `better'

2) The immediate workaround is

as.POSIXct(x, tz="GMT")

which avoids the OS's routines altogether.

On Thu, 2 Jan 2003, Frank E Harrell Jr wrote:

> > x <- strptime(c('10/10/1969','12/31/2002'),format='%m/%d/%Y')
> > x
> [1] "1969-10-10" "2002-12-31"
> > as.POSIXct(x)
> [1] NA               "2002-12-31 EST"
> Why the NA?  If this is not the preferred way to convert a character string to POSIXct what is?  On a more minor note why the EST if no time is printed?

Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list