Errors and OS Differences with as.POSIXct and as.POSIXlt

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Errors and OS Differences with as.POSIXct and as.POSIXlt

Bill Denney
Hello,

 

Dates created with as.POSIXct differ between Windows/Mac and Linux.
Specifically this time that is during a gap when the hour does not exist due
to daylight savings time:

 

as.POSIXct("2018-03-11 02:09:36", tz="America/New_York")

 

Gives on Windows:

[1] "2018-03-11 EST"

Gives on Linux (Ubuntu 20.04):

[1] "2018-03-11 01:09:36 EST"

 

Another issue and difference is that with as.POSIXlt on Linux, the invalid
time is presented:

 

as.POSIXlt("2018-03-11 02:09", tz="America/New_York")

 

Gives on Windows:

[1] "2018-03-11 EST"

Gives on Linux:

[1] "2018-03-11 02:09:00 EDT"

 

(Note that the time provided on Linux does not exist due to daylight savings
time.)

 

I think that for any invalid time, the result should be the same as an
invalid date:  NA is returned.

 

What is the intended, appropriate time, and what is the best way to fix
this?

 

Thanks,

 

Bill


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.