time one hour early?

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Thu May 6 10:01:37 UTC 1999


On Thu, 6 May 1999, Markus Kohler wrote:

> Same problem on HP-UX. 
> 
> I live in Germany and we have Summertime.
> 
> Could that explain it ?

It has to do with the problem. The Unix VMs ioSeconds() primitive is not
correct. I once tried to find a solution - but I did not succeed. I'll
attach the mail I sent to Ian one month ago. Maybe you guys have more
patience than me getting this right ... 

-------------------------------------------
Hi Ian,

my Squeak still doesn't do "Time now" right. It's off by one hour. I
haven't really tracked it down, but I guess it has to do with daylight
saving. I wrote a little C program: 

#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
int main()
{
  struct timeval tv;
  gettimeofday(&tv, 0);
  printf("timezone:    %i\n", timezone);
  printf("daylight:    %i\n", daylight);
  printf("localtime(): %s", asctime(localtime(&tv.tv_sec)));
  printf("gmtime():    %s", asctime(gmtime(&tv.tv_sec)));
  printf("timezone:    %i\n", timezone);
  printf("daylight:    %i\n", daylight);
}

This produces

timezone:    0
daylight:    0
localtime(): Wed Apr  7 15:17:57 1999
gmtime():    Wed Apr  7 13:17:57 1999
timezone:    -3600
daylight:    1

but Time now gives 2:18:19 pm ...

First observation: timezone is not set before localtime() is called. 
Second: It does not reflect daylight saving.

Any idea?
-------------------------------------------

/bert

-- 
 Bert Freudenberg                                       Department of 
                                                        Simulation and
 mailto:bert at isg.cs.uni-magdeburg.de                    Computer Graphics
 http://isgwww.cs.uni-magdeburg.de/isg/bert.html        Univ. of Magdeburg





More information about the Squeak-dev mailing list