| Line 1... |
Line 1... |
| 1 |
|
1 |
|
| 2 |
R Under development (unstable) (2026-06-09 r90126) -- "Unsuffered Consequences"
|
2 |
R Under development (unstable) (2026-06-12 r90138) -- "Unsuffered Consequences"
|
| 3 |
Copyright (C) 2026 The R Foundation for Statistical Computing
|
3 |
Copyright (C) 2026 The R Foundation for Statistical Computing
|
| 4 |
Platform: aarch64-apple-darwin25.4.0
|
4 |
Platform: x86_64-pc-linux-gnu
|
| 5 |
|
5 |
|
| 6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
| 7 |
You are welcome to redistribute it under certain conditions.
|
7 |
You are welcome to redistribute it under certain conditions.
|
| 8 |
Type 'license()' or 'licence()' for distribution details.
|
8 |
Type 'license()' or 'licence()' for distribution details.
|
| 9 |
|
9 |
|
| Line 17... |
Line 17... |
| 17 |
|
17 |
|
| 18 |
> ### Tests of often platform-dependent features of the POSIX[cl]t implementation.
|
18 |
> ### Tests of often platform-dependent features of the POSIX[cl]t implementation.
|
| 19 |
>
|
19 |
>
|
| 20 |
> ### Expect differences, historically with 32-bit time_t and platforms
|
20 |
> ### Expect differences, historically with 32-bit time_t and platforms
|
| 21 |
> ### without tm_zone/tm_gmtoff.
|
21 |
> ### without tm_zone/tm_gmtoff.
|
| - |
|
22 |
> ### Also with musl (wrongly using current not historic "zone" abbreviations).
|
| 22 |
> ### Please use the R-internal version for .Rout.save.
|
23 |
> ### Please use the R-internal version for .Rout.save.
|
| - |
|
24 |
> ## IGNORE_RDIFF_BEGIN
|
| - |
|
25 |
> (tzCtype <- sessionInfo()[["tzcode_type"]])
|
| - |
|
26 |
[1] "internal"
|
| - |
|
27 |
> ## IGNORE_RDIFF_END
|
| 23 |
>
|
28 |
>
|
| 24 |
> z <- ISOdate(1890:1912, 1, 10, tz="UTC")
|
29 |
> z <- ISOdate(1890:1912, 1, 10, tz="UTC")
|
| 25 |
> ## Rome changed to CET for 1894
|
30 |
> ## Rome changed to CET for 1894
|
| 26 |
> as.POSIXlt(z, tz="Europe/Rome")
|
31 |
> as.POSIXlt(z, tz="Europe/Rome")
|
| 27 |
[1] "1890-01-10 12:49:56 RMT" "1891-01-10 12:49:56 RMT"
|
32 |
[1] "1890-01-10 12:49:56 RMT" "1891-01-10 12:49:56 RMT"
|
| Line 316... |
Line 321... |
| 316 |
> for(i in seq_along(years)) {
|
321 |
> for(i in seq_along(years)) {
|
| 317 |
+ zz$year = years[i] - 1900
|
322 |
+ zz$year = years[i] - 1900
|
| 318 |
+ y[i] <- strftime(zz)
|
323 |
+ y[i] <- strftime(zz)
|
| 319 |
+ }
|
324 |
+ }
|
| 320 |
> ## IGNORE_RDIFF_BEGIN
|
325 |
> ## IGNORE_RDIFF_BEGIN
|
| 321 |
> (tzCtype <- sessionInfo()[["tzcode_type"]])
|
- |
|
| 322 |
[1] "internal"
|
- |
|
| 323 |
> y
|
326 |
> y
|
| 324 |
[1] "-1000000-07-01" "-100000-07-01" "-10000-07-01" "-1000-07-01"
|
327 |
[1] "-1000000-07-01" "-100000-07-01" "-10000-07-01" "-1000-07-01"
|
| 325 |
[5] "-900-07-01" "-800-07-01" "-700-07-01" "-600-07-01"
|
328 |
[5] "-900-07-01" "-800-07-01" "-700-07-01" "-600-07-01"
|
| 326 |
[9] "-500-07-01" "-400-07-01" "-300-07-01" "-200-07-01"
|
329 |
[9] "-500-07-01" "-400-07-01" "-300-07-01" "-200-07-01"
|
| 327 |
[13] "-100-07-01" "0000-07-01" "0100-07-01" "0200-07-01"
|
330 |
[13] "-100-07-01" "0000-07-01" "0100-07-01" "0200-07-01"
|
| Line 486... |
Line 489... |
| 486 |
>
|
489 |
>
|
| 487 |
> ## offsets not in whole hours:
|
490 |
> ## offsets not in whole hours:
|
| 488 |
> x3 <- strptime("2022-01-01", "%Y-%m-%d", tz = "Australia/Adelaide")
|
491 |
> x3 <- strptime("2022-01-01", "%Y-%m-%d", tz = "Australia/Adelaide")
|
| 489 |
> format(as.POSIXct(x3), "%a, %d %b %Y %H:%M:%S %z") # +10h30m
|
492 |
> format(as.POSIXct(x3), "%a, %d %b %Y %H:%M:%S %z") # +10h30m
|
| 490 |
[1] "Sat, 01 Jan 2022 00:00:00 +1030"
|
493 |
[1] "Sat, 01 Jan 2022 00:00:00 +1030"
|
| 491 |
> # macOS' strftime printed the next two wrong.
|
- |
|
| 492 |
> # Liberia does/did not have DST
|
494 |
> # Liberia does/did not have DST and, before 1972-01-07, used MMT (-44m30s)
|
| 493 |
> x4 <- strptime("1971-01-01", "%Y-%m-%d", tz = "Africa/Monrovia")
|
495 |
> x4 <- strptime("1971-01-01", "%Y-%m-%d", tz = "Africa/Monrovia")
|
| 494 |
> y4 <- as.POSIXct(x4)
|
496 |
> y4 <- as.POSIXct(x4)
|
| 495 |
>
|
497 |
> lt4 <- unclass(as.POSIXlt(y4))
|
| 496 |
> ## IGNORE_RDIFF_BEGIN
|
498 |
> ## IGNORE_RDIFF_BEGIN
|
| - |
|
499 |
> attr(lt4, "tzone")
|
| - |
|
500 |
[1] "Africa/Monrovia" "GMT" " "
|
| - |
|
501 |
> ## glibc prints an abbreviation for DST. internal and musl leave it blank.
|
| - |
|
502 |
> ## IGNORE_RDIFF_END
|
| - |
|
503 |
> stopifnot(identical(
|
| 497 |
> str(lt4 <- unclass(as.POSIXlt(y4))) # correct gmtoff, printed wrong as -44m
|
504 |
+ attr(lt4, "tzone") |> trimws(), # ignore " " (internal) vs. "" (musl)
|
| - |
|
505 |
+ c("Africa/Monrovia", "GMT", if(grepl("glibc", tzCtype)) "GMT" else "")
|
| - |
|
506 |
+ ))
|
| - |
|
507 |
> str(`attr<-`(lt4, "tzone", NULL))
|
| 498 |
List of 11
|
508 |
List of 11
|
| 499 |
$ sec : num 0
|
509 |
$ sec : num 0
|
| 500 |
$ min : int 0
|
510 |
$ min : int 0
|
| 501 |
$ hour : int 0
|
511 |
$ hour : int 0
|
| 502 |
$ mday : int 1
|
512 |
$ mday : int 1
|
| Line 505... |
Line 515... |
| 505 |
$ wday : int 5
|
515 |
$ wday : int 5
|
| 506 |
$ yday : int 0
|
516 |
$ yday : int 0
|
| 507 |
$ isdst : int 0
|
517 |
$ isdst : int 0
|
| 508 |
$ zone : chr "MMT"
|
518 |
$ zone : chr "MMT"
|
| 509 |
$ gmtoff: int -2670
|
519 |
$ gmtoff: int -2670
|
| 510 |
- attr(*, "tzone")= chr [1:3] "Africa/Monrovia" "GMT" " "
|
- |
|
| 511 |
- attr(*, "balanced")= logi TRUE
|
520 |
- attr(*, "balanced")= logi TRUE
|
| 512 |
> # glibc prints an abbreviation for DST.
|
- |
|
| 513 |
> ## IGNORE_RDIFF_END
|
- |
|
| 514 |
> stopifnot(identical(attr(lt4, "tzone"),
|
- |
|
| 515 |
+ c("Africa/Monrovia", "GMT", if(grepl("glibc", tzCtype)) "GMT" else " ")),
|
521 |
> ## musl wrongly gives zone="GMT" (the current, not that at the time).
|
| 516 |
+ identical(`attr<-`(lt4, "tzone", NULL),
|
522 |
> ## macOS' strftime printed gmtoff wrong as -44m.
|
| 517 |
+ structure(list(sec = 0, min = 0L, hour = 0L, mday = 1L, mon = 0L, year = 71L,
|
- |
|
| 518 |
+ wday = 5L, yday = 0L, isdst = 0L, zone = "MMT", gmtoff = -2670L),
|
- |
|
| 519 |
+ balanced = TRUE)))
|
- |
|
| 520 |
>
|
- |
|
| 521 |
> format(y4, "%a, %d %b %Y %H:%M:%S %z")
|
523 |
> format(y4, "%a, %d %b %Y %H:%M:%S %z")
|
| 522 |
[1] "Fri, 01 Jan 1971 00:00:00 -0044"
|
524 |
[1] "Fri, 01 Jan 1971 00:00:00 -0044"
|
| - |
|
525 |
>
|
| 523 |
> ## timezones in 1900 might not be supported
|
526 |
> ## timezones in 1900 might not be supported
|
| 524 |
> x5 <- strptime("1900-03-01", "%Y-%m-%d", tz = "Europe/Paris")
|
527 |
> x5 <- strptime("1900-03-01", "%Y-%m-%d", tz = "Europe/Paris")
|
| 525 |
> y5 <- as.POSIXct(x5)
|
528 |
> y5 <- as.POSIXct(x5)
|
| 526 |
> str(unclass(as.POSIXlt(y5))) # ditto
|
529 |
> str(unclass(as.POSIXlt(y5))) # ditto
|
| 527 |
List of 11
|
530 |
List of 11
|
| Line 540... |
Line 543... |
| 540 |
- attr(*, "balanced")= logi TRUE
|
543 |
- attr(*, "balanced")= logi TRUE
|
| 541 |
> format(y5, "%a, %d %b %Y %H:%M:%S %z")
|
544 |
> format(y5, "%a, %d %b %Y %H:%M:%S %z")
|
| 542 |
[1] "Thu, 01 Mar 1900 00:00:00 +0009"
|
545 |
[1] "Thu, 01 Mar 1900 00:00:00 +0009"
|
| 543 |
>
|
546 |
>
|
| 544 |
> cat('Time elapsed: ', proc.time(),'\n')
|
547 |
> cat('Time elapsed: ', proc.time(),'\n')
|
| 545 |
Time elapsed: 0.113 0.03 0.154 0.005 0.007
|
548 |
Time elapsed: 0.158 0.027 0.187 0.002 0.003
|
| 546 |
>
|
549 |
>
|