[Rd] Sys.timzone() returns NA - problem caused by as.POSIXlt? (PR#7994)
mkeller@fam.tuwien.ac.at
mkeller at fam.tuwien.ac.at
Thu Jul 7 12:23:23 CEST 2005
Full_Name: Martin Keller-Ressel
Version: 2.1.1
OS: Windows 2000
Submission from: (NULL) (128.130.51.88)
Sys.timezone() returns NA although the environment variable TZ is set to GMT
and
Sys.time() returns the correct time and date including the right timezone.
The problem is probably due to as.POSIXlt() which is used by Sys.timezone().
The problem has been confirmed by Uwe Ligges for R 2.1.1 on Windows NT 4.0.
See below for a R session outlining the problem:
> Sys.getenv("TZ")
TZ
"GMT"
> Sys.time()
[1] "2005-07-07 10:28:11 GMT"
> Sys.timezone()
[1] NA
> Sys.timezone
function ()
{
z <- as.POSIXlt(Sys.time())
attr(z, "tzone")[2 + z$isdst]
}
<environment: namespace:base>
> z <- as.POSIXlt(Sys.time())
> attributes(z)
$names
[1] "sec" "min" "hour" "mday" "mon" "year" "wday" "yday" "isdst"
$class
[1] "POSIXt" "POSIXlt"
$tzone
[1] "GMT"
> attr(z,"tzone")
[1] "GMT"
> z$isdst
[1] 0
> attr(z,"tzone")[2]
[1] NA
More information about the R-devel
mailing list