Michael Chirico
2026-Jan-14 22:47 UTC
[Rd] Non-deterministic POSIXlt tzone in Europe/London around UTC 0
As a test case I have code running 'as.POSIXlt(1:10)', which can unfortunately produce non-deterministic results: TZ=Europe/London R attr(as.POSIXlt(as.numeric(1:10)), 'tzone') # [1] "Europe/London" "GMT" "BST" attr(as.POSIXlt(as.numeric(1:10)), 'tzone') # [1] "Europe/London" "BST" "BST" Is this intended behavior? I don't see this possibility described in any of ?DateTimeClasses, ?strptime, ?timezones, or ?as.POSIXlt. Some caching is mentioned around .sys.timezone, but the above snippets don't have any relationship that I can see. Mike C
Ben Bolker
2026-Jan-14 23:21 UTC
[Rd] Non-deterministic POSIXlt tzone in Europe/London around UTC 0
It seems not so much non-deterministic, as different on the first vs.
following invocations ...
$ cat tz.R
Sys.setenv(TZ="Europe/London")
for (i in 1:10) {
print(attr(as.POSIXlt(as.numeric(1:10)), 'tzone'))
$ Rscript tz.R
[1] "Europe/London" "GMT" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
$ Rscript tz.R
[1] "Europe/London" "GMT" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
$ Rscript tz.R
[1] "Europe/London" "GMT" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
[1] "Europe/London" "BST" "BST"
On 1/14/26 17:47, Michael Chirico via R-devel wrote:> As a test case I have code running 'as.POSIXlt(1:10)', which can
> unfortunately produce non-deterministic results:
>
> TZ=Europe/London R
> attr(as.POSIXlt(as.numeric(1:10)), 'tzone')
> # [1] "Europe/London" "GMT" "BST"
> attr(as.POSIXlt(as.numeric(1:10)), 'tzone')
> # [1] "Europe/London" "BST" "BST"
>
> Is this intended behavior? I don't see this possibility described in
> any of ?DateTimeClasses, ?strptime, ?timezones, or ?as.POSIXlt. Some
> caching is mentioned around .sys.timezone, but the above snippets
> don't have any relationship that I can see.
>
> Mike C
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
--
Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Associate chair (graduate), Mathematics & Statistics
Director, School of Computational Science and Engineering
* E-mail is sent at my convenience; I don't expect replies outside of
working hours.