1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
R version 3.1.1 RC (2014-07-04 r66081) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> #### Test 64-bit date-time functions.
>
> ## R's internal fixes are used on 32-bit platforms.
> ## OS X gets these wrong: see HAVE_WORKING_64BIT_MKTIME
>
> Sys.setenv(TZ = "UTC")
> (z <- as.POSIXct("1848-01-01 12:00"))
[1] "1848-01-01 12:00:00 UTC"
> c(unclass(z))
[1] -3849940800
> (z <- as.POSIXct("2040-01-01 12:00"))
[1] "2040-01-01 12:00:00 UTC"
> c(unclass(z))
[1] 2209032000
> (z <- as.POSIXct("2040-07-01 12:00"))
[1] "2040-07-01 12:00:00 UTC"
> c(unclass(z))
[1] 2224756800
>
> Sys.setenv(TZ = "Europe/London") # pretty much portable.
> (z <- as.POSIXct("1848-01-01 12:00"))
[1] "1848-01-01 12:00:00 GMT"
> c(unclass(z))
[1] -3849940800
> (z <- as.POSIXct("2040-01-01 12:00"))
[1] "2040-01-01 12:00:00 GMT"
> c(unclass(z))
[1] 2209032000
> (z <- as.POSIXct("2040-07-01 12:00"))
[1] "2040-07-01 12:00:00 BST"
> c(unclass(z))
[1] 2224753200
>
> Sys.setenv(TZ = "EST5EDT")
> (z <- as.POSIXct("1848-01-01 12:00"))
[1] "1848-01-01 12:00:00 EST"
> c(unclass(z))
[1] -3849922800
> (z <- as.POSIXct("2040-01-01 12:00"))
[1] "2040-01-01 12:00:00 EST"
> c(unclass(z))
[1] 2209050000
> (z <- as.POSIXct("2040-07-01 12:00"))
[1] "2040-07-01 12:00:00 EDT"
> c(unclass(z))
[1] 2224771200
>
> ## PR15613: had day as > 24hrs.
> as.POSIXlt(ISOdate(2071,1,13,0,0,tz="Etc/GMT-1"))$wday
[1] 2
> as.POSIXlt(ISOdate(2071,1,13,0,1,tz="Etc/GMT-1"))$wday
[1] 2
>
>
> ## Incorrect use of %d should work even though abbreviation does match
> old <- Sys.setlocale("LC_TIME", "C") # to be sure
> stopifnot(!is.na(strptime("11-August-1903", "%d-%b-%Y")))
>
|