From mkeller at fam.tuwien.ac.at  Thu Jul  7 12:23:23 2005
From: mkeller at fam.tuwien.ac.at (mkeller@fam.tuwien.ac.at)
Date: Thu,  7 Jul 2005 12:23:23 +0200 (CEST)
Subject: [Rd] Sys.timzone() returns NA - problem caused by as.POSIXlt?
	(PR#7994)
Message-ID: <20050707102323.C9057AD65@slim.kubism.ku.dk>

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



[Rd] Sys.timzone() returns NA - problem caused by as.POSIXlt? (PR#7994)
mkeller@fam.tuwien.ac.at