This behaviour is documented in ?c
, ?DateTimeClasses
and ?unlist
:
From ?DateTimeClasses
:
Using c
on "POSIXlt
" objects converts them to the current time zone, and on "POSIXct
" objects drops any "tzone
" attributes (even if they are all marked with the same time zone).*
From ?c
:
c
is sometimes used for its side effect of removing attributes except names.*
That said, my testing indicates that the integrity of your data remains intact, despite using c
or unlist
. For example:
x <- structure(1317830532, class = c("POSIXct", "POSIXt"),
tzone = "GMT")
y <- structure(1317830532+3600, class = c("POSIXct", "POSIXt"),
tzone = "PST8PDT")
x
[1] "2011-10-05 16:02:12 GMT"
y
[1] "2011-10-05 10:02:12 PDT"
strftime(c(x, y), format="%Y/%m/%d %H:%M:%S", tz="GMT")
[1] "2011/10/05 16:02:12" "2011/10/05 17:02:12"
strftime(c(x, y), format="%Y/%m/%d %H:%M:%S", tz="PST8PDT")
[1] "2011/10/05 09:02:12" "2011/10/05 10:02:12"
strftime(unlist(y), format="%Y/%m/%d %H:%M:%S", tz="PST8PDT")
[1] "2011/10/05 10:02:12"
Your Mars Rover should be OK if you use R to keep track of dates.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…