[prev in list] [next in list] [prev in thread] [next in thread]
List: r-devel
Subject: [Rd] The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsi
From: IAGO_GINÉ_VÁZQUEZ <i.gine () pssjd ! org>
Date: 2020-10-23 17:03:37
Message-ID: AM6PR02MB44230E9118756F38C48381F8921A0 () AM6PR02MB4423 ! eurprd02 ! prod ! outlook ! com
[Download RAW message or body]
Dear all,
I have just detected what seems a minor inconsistence with data types. If one unlists \
a POSIXlt time with GMT zone gets a numeric vector, since the POSIXlt list has no \
`zone` element, while if one unlists a POSIXlt time with a non GMT zone (also non \
specifying tz if the Sys.timezone is not GMT) gets a character vector due to \
including the `zone` element.
> x <- as.POSIXlt(Sys.time(), "GMT")
> (y <- unlist(x))
sec min hour mday mon year wday yday \
isdst 54.99715 26.00000 16.00000 23.00000 9.00000 120.00000 5.00000 296.00000 \
0.00000
> str(y)
Named num [1:9] 55 26 16 23 9 ...
- attr(*, "names")= chr [1:9] "sec" "min" "hour" "mday" ...
> x <- as.POSIXlt(Sys.time(), "CET")
> (y <- unlist(x))
sec min hour mday \
mon year wday yday "19.5111262798309" \
"27" "18" "23" "9" "120" \
"5" "296" isdst zone gmtoff
"1" "CEST" "7200"
> str(y)
Named chr [1:11] "19.5111262798309" "27" "18" "23" "9" "120" "5" "296" "1" "CEST" \
"7200"
- attr(*, "names")= chr [1:11] "sec" "min" "hour" "mday" ...
Is it expected? Why do not include always `zone` as an element of POSIXlt? Should \
POSIXlt objects be unlisted in a different way? Thank you!
Best regards,
Iago
PS: I was using R 4.0.3. I don't know if this behaviour already changed in R-devel. \
Excuse me in that case.
[[alternative HTML version deleted]]
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic