[R] system time is 5 hours off in Windows

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Jan 23 08:37:43 CET 2001


On Mon, 22 Jan 2001 Setzer.Woodrow at epamail.epa.gov wrote:

[...]

> I've found the warning in the documentation for as.POSIXct to try setting
> TZ on UNIX-like systems if the POSIX functions give unusual results;
> perhaps this should apply to Windows systems, too?  That doesn't explain

It seems OK everywhere else, whic is why it is not mentioned there.

> the return of date() which relies on the OS to set the time zone (and, when
> I execute the same code as a stand-alone program, I get the correct system
> time).  It is as if some startup code looks for TZ in the environment, and
> if it is not there, sets it to a value which, perhaps, the system does not
> recognize as valid, and defaults to GMT.

Windows code does not use TZ according to its documentation.

> This is what I get inside Rgui when I query the TZ variable (I have not set
> it in the environment):
>
> > Sys.getenv("TZ")
>                      TZ
> "Eastern Daylight Time"

R sets it for its own purposes.

> It seems to me that, if this is going to be used to set the time zone for
> POSIX functions, it should look like one of the standard ways of specifying
> a time zone (all I know about this is what I read in the libc manual about
> the POSIX date-time functions, so I may be way off base here for the
> Windows implementation).

Right. It is not documented and does not in general work for Windows.
We do it by hand on Windows.  It is possible that what we do (using
tzname and tzset()) is upsetting date(), which I have no idea how it works,


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list