[R] timezone problems

Don MacQueen macq at llnl.gov
Wed Jul 6 16:45:25 CEST 2005


How did you set the TZ system variable?
If you did not use Sys.putenv(), try using it instead.
Otherwise, I think you have to ask the package maintainer.

You may be misleading yourself by using Sys.time() to test whether TZ is set.
What does Sys.getenv() tell you?

I get a timezone code from Sys.time() even when TZ is not defined 
(see example below).
(but I do have a different OS)

>  Sys.timezone()
[1] ""
>  Sys.time()
[1] "2005-07-06 07:34:15 PDT"
>  Sys.getenv('TZ')
TZ
""
>  Sys.putenv(TZ='US/Pacific')
>  Sys.timezone()
[1] "US/Pacific"
>  Sys.getenv('TZ')
           TZ
"US/Pacific"
>  Sys.time()
[1] "2005-07-06 07:34:38 PDT"

>  Sys.putenv(TZ='GMT')
>  Sys.time()
[1] "2005-07-06 14:35:45 GMT"

>  version
          _                       
platform powerpc-apple-darwin7.9.0
arch     powerpc                 
os       darwin7.9.0             
system   powerpc, darwin7.9.0    
status                           
major    2                       
minor    1.1                     
year     2005                    
month    06                      
day      20                      
language R                       


At 9:55 AM +0000 7/5/05, Martin Keller-Ressel wrote:
>Hi,
>
>Im using R 2.1.1 and running Code that previously worked (on R 2.1.0 I 
>believe) using the 'timeDate' function from the fCalendar package. The 
>code now throws an error:
>
>Error in if (Sys.timezone() != "GMT") warning("Set timezone to GMT!")
>
>However I have read the documentation of the fCalendar package and I have 
>set my system variable TZ to GMT.
>I tracked the error down to the function Sys.timezone() which returns NA 
>in spite of what Sys.time() returns.
>
>>  Sys.timezone()
>[1] NA
>
>>  Sys.time()
>[1] "2005-07-05 08:41:53 GMT"
>
>My version:
>
>>  version
>           _
>platform i386-pc-mingw32
>arch     i386
>os       mingw32
>system   i386, mingw32
>status
>major    2
>minor    1.1
>year     2005
>month    06
>day      20
>language R
>
>Any help is appreciated,
>
>Martin Keller-Ressel
>
>
>---
>Martin Keller-Ressel
>Research Unit of Financial and Actuarial Mathematics
>TU Vienna
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA




More information about the R-help mailing list