Skip to content

system time is 5 hours off in Windows

2 messages · Setzer.Woodrow@epamail.epa.gov, Thomas Lumley

#
Curiouser and curiouser ...

I rewrote the function R_date (do_date is just a wrapper around R_date)
slightly to make it a standalone program (here i did not replace the
trailing '\n' with '\0', and printed out the result):

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>

int main(void)
{
  time_t t;
  char s[26];

  time(&t);
  strcpy(s, ctime(&t));
  printf("%s\n",s);
  return(0);
}

The result is [gcc is i386-mingw32msvc-gcc.exe from the gcc-2.95.2-1 mingw
distribution ]:

D:\home\setzer\newstuff\tmp>gcc -o testtime testtime.c

D:\home\setzer\newstuff\tmp>testtime
Mon Jan 22 12:31:17 2001

D:\home\setzer\newstuff\tmp>time
Current time is 12:31:27.89p
Enter new time:


A little later, in R-1.2.1:
[1] "Mon Jan 22 17:32:24 2001"
R. Woodrow Setzer, Jr.                                            Phone:
(919) 541-0128
Experimental Toxicology Division                       Fax:  (919) 541-5394
Pharmacokinetics Branch
NHEERL MD-74; US EPA; RTP, NC 27711


                                                                                                                       
                    Woodrow                                                                                            
                    Setzer/RTP/USEPA/US@        To:     r-help at lists.R-project.org                                     
                    EPA                         cc:                                                                    
                    Sent by:                    Subject:     [R] system time is 5 hours off in Windows                 
                    owner-r-help at stat.ma                                                                               
                    th.ethz.ch                                                                                         
                                                                                                                       
                                                                                                                       
                    01/19/2001 04:49 PM                                                                                
                                                                                                                       
                                                                                                                       



Am I missing a configuration step?  The value returned by date() and
Sys.time() is five hours later than the system time.  Furthermore,
Sys.timezone() returns Eastern Daylight Time, whereas we are really
currently in Eastern Standard Time.  I am running:

         _
platform i386-pc-mingw32
arch     x86
os       Win32
system   x86, Win32
status
major    1
minor    2.1
year     2001
month    01
day      15
language R


R. Woodrow Setzer, Jr.                                            Phone:
(919) 541-0128
Experimental Toxicology Division                       Fax:  (919) 541-5394
Pharmacokinetics Branch
NHEERL MD-74; US EPA; RTP, NC 27711

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._._





-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Mon, 22 Jan 2001 Setzer.Woodrow at epamail.epa.gov wrote:

            
Since you are in time zone -5 (according to your mail headers) it looks as
if you may well  have a configuration problem. 

It appears that for some reason you are getting UTC rather than your local
time.  I have seen this happen under Linux: there's a choice of whether
the real time clock should run local time or should run UTC and have the
system apply the time zone correction. I don't know anything about the
Windows situation, though.

	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._