Skip to content

Commit c9437a8

Browse files
author
maechler
committed
allow tzdata without legacy
git-svn-id: https://svn.r-project.org/R/trunk@87322 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 0da28aa commit c9437a8

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

tests/reg-tests-1c.R

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,18 +1597,31 @@ tools::assertWarning(verbose=TRUE,
15971597
## format.POSIXlt() of Jan.1 if 1941 or '42 is involved:
15981598
tJan1 <- function(n1, n2)
15991599
strptime(paste0(n1:n2,"/01/01"), "%Y/%m/%d", tz="CET")
1600-
wDSTJan1 <- function(n1, n2)
1601-
which("CEST" == sub(".* ", '', format(tJan1(n1,n2), usetz=TRUE)))
1602-
(w8 <- wDSTJan1(1801, 2300))
1603-
(w9 <- wDSTJan1(1901, 2300))
1604-
stopifnot(identical(w8, 141:142),# exactly 1941:1942 had CEST on Jan.1
1605-
identical(w9, 41: 42))
1600+
f8 <- format(tJan1(1801, 2300), usetz=TRUE)
1601+
f9 <- format(tJan1(1901, 2300), usetz=TRUE)
1602+
rle8 <- rle(s8 <- sub(".* ",'', f8))
1603+
rle9 <- rle(s9 <- sub(".* ",'', f9))
1604+
w8 <- which(s8 == "CEST")
1605+
w9 <- which(s9 == "CEST")
1606+
## IGNORE_RDIFF_BEGIN
1607+
rle8
1608+
## very platform dependently; originally got
1609+
## lengths: int [1:3] 140 2 358
1610+
## values : chr [1:3] "CET" "CEST" "CET"
1611+
w8 # 141 142
1612+
w9 # 41 42
1613+
## IGNORE_RDIFF_END
1614+
## Debian's tzdata 2024b no longer contains "legacy" (but tzdata-legacy does)
1615+
## --> everything "CET" [ <==> !length(w..) ]
1616+
stopifnot(!length(w8) || identical(w8, 141:142),# exactly 1941:1942 had CEST on Jan.1
1617+
!length(w9) || identical(w9, 41: 42))
16061618
## for R-devel Jan.2016 to Mar.14 -- *AND* for R 3.2.4 -- the above gave
16071619
## integer(0) and c(41:42, 99:100, ..., 389:390) respectively
1608-
1620+
##
16091621
## the above gives 1:142 and 1:42 respectively on Solaris 10 when not using
16101622
## --with-internal-tzcode; R-Admin recommends --with-internal-tzcode.
16111623

1624+
16121625
## tsp<- did not remove mts class
16131626
z <- ts(cbind(1:5,1:5))
16141627
tsp(z) <- NULL

0 commit comments

Comments
 (0)