| 73760 |
maechler |
1 |
#### Test R's (64-bit) date-time functions .. output tested *sloppily*
|
| 64342 |
ripley |
2 |
|
|
|
3 |
## R's internal fixes are used on 32-bit platforms.
|
| 70779 |
ripley |
4 |
## macOS gets these wrong: see HAVE_WORKING_64BIT_MKTIME
|
| 64342 |
ripley |
5 |
|
|
|
6 |
Sys.setenv(TZ = "UTC")
|
|
|
7 |
(z <- as.POSIXct("1848-01-01 12:00"))
|
|
|
8 |
c(unclass(z))
|
|
|
9 |
(z <- as.POSIXct("2040-01-01 12:00"))
|
|
|
10 |
c(unclass(z))
|
|
|
11 |
(z <- as.POSIXct("2040-07-01 12:00"))
|
|
|
12 |
c(unclass(z))
|
|
|
13 |
|
|
|
14 |
Sys.setenv(TZ = "Europe/London") # pretty much portable.
|
|
|
15 |
(z <- as.POSIXct("1848-01-01 12:00"))
|
|
|
16 |
c(unclass(z))
|
| 75856 |
ripley |
17 |
## We don't know the operation of timezones next year let alone in 2040
|
| 75348 |
ripley |
18 |
## but these should at least round-trip
|
| 75855 |
ripley |
19 |
## These got the wrong timezone on Linux with glibc 2.2[67]
|
| 75348 |
ripley |
20 |
as.POSIXct("2040-01-01 12:00")
|
|
|
21 |
as.POSIXct("2040-07-01 12:00")
|
| 64342 |
ripley |
22 |
|
| 75348 |
ripley |
23 |
Sys.setenv(TZ = "EST5EDT") # also pretty much portable.
|
| 64342 |
ripley |
24 |
(z <- as.POSIXct("1848-01-01 12:00"))
|
|
|
25 |
c(unclass(z))
|
| 75855 |
ripley |
26 |
## see comment above
|
| 75348 |
ripley |
27 |
as.POSIXct("2040-01-01 12:00")
|
|
|
28 |
as.POSIXct("2040-07-01 12:00")
|
| 64517 |
ripley |
29 |
|
|
|
30 |
## PR15613: had day as > 24hrs.
|
|
|
31 |
as.POSIXlt(ISOdate(2071,1,13,0,0,tz="Etc/GMT-1"))$wday
|
|
|
32 |
as.POSIXlt(ISOdate(2071,1,13,0,1,tz="Etc/GMT-1"))$wday
|
| 64816 |
ripley |
33 |
|
|
|
34 |
|
| 75348 |
ripley |
35 |
## Incorrect use of %b should work even though abbreviation does match
|
| 64816 |
ripley |
36 |
old <- Sys.setlocale("LC_TIME", "C") # to be sure
|
|
|
37 |
stopifnot(!is.na(strptime("11-August-1903", "%d-%b-%Y")))
|