www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/25/05:05:23

Subject: Re: 1.12.maint1, second beta
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Thu, 25 Aug 1994 10:06:03 +0200 (MET DST)
From: Henrik Storner <storner AT olicom DOT dk>

[odd things happening with our mail-system here, so I'm resending this to
 the list. hst]

> DJ writes:
> 
> > As for timezones, all works properly if you use the minimal setting -
> > no DST fields, like this:
> > 
> > 	set TZ=est5
> 
> Sorry, but - no. stat() is still broken. I used the following bit of
> code to try this out:
> 
> #include <dos.h>
> #include <string.h>
> #include <stdlib.h>
> #include <time.h>
> #include <stdio.h>
> #include <sys/timeb.h>
> #include <sys/stat.h>
> 
> void main(void)
> {
>     time_t now;
>     struct time tbuf;
>     struct timeb fbuf;
>     FILE *f;
>     struct stat st;
> 
>     tzset();
> 
>     gettime(&tbuf);
>     printf("gettime() returns %d %d %d\n", 
>            tbuf.ti_hour, tbuf.ti_min, tbuf.ti_sec);
> 
>     time(&now); ftime(&fbuf);
> 
>     printf("time() gives %ld\n", now);
>     printf("ftime() gives time=%ld, timzone=%d, dst=%d\n", 
>             fbuf.time, fbuf.timezone, fbuf.dstflag);
> 
>     printf("localtime() is %s", asctime(localtime(&now)));
>     printf("gmtime()    is %s", asctime(gmtime(&now)));
> 
>     /* Create a file; it should have a timestamp of current GMT-time */
>     f = fopen("timetest", "w"); fclose(f);
>     stat("timetest", &st);
>     printf("stat() reports filetime of %ld = %s\n", st.st_mtime,
>            asctime(gmtime(&st.st_mtime)));
> }
> 
> With go32 1.12.maint1 I get the following results:
> 
> With TZ=MET-1METDST-2,M3.5.0/02:00,M9.5.0/02:00
> 	gettime() returns 9 32 48
> 	time() gives 777799968
> 	ftime() gives time=777799968, timzone=-60, dst=1
> 	localtime() is Thu Aug 25 09:32:48 1994
> 	gmtime()    is Thu Aug 25 07:32:48 1994
> 	stat() reports filetime of 777821568 = Thu Aug 25 13:32:48 1994
> 
> With TZ=MET-2 (no DST fields!)
> 	gettime() returns 9 33 3
> 	time() gives 777799983
> 	ftime() gives time=777799983, timzone=-120, dst=0
> 	localtime() is Thu Aug 25 09:33:03 1994
> 	gmtime()    is Thu Aug 25 07:33:03 1994
> 	stat() reports filetime of 777821582 = Thu Aug 25 13:33:02 1994
> 
> 
> In either case, I get a timestamp that is 6 hours ahead of what it should
> be. In fact, stat() doesn't care a bit what the TZ setting is; I get the
> same result whether I have no TZ setting, or TZ=EST5, or ...
-- 
Henrik Storner        | "Man is the best computer we can put aboard a space-
(storner AT olicom DOT dk)   |  craft ... and the only one that can be mass produced 
System Engineering    |  with unskilled labor."
Olicom Denmark        |                                   Wernher von Braun

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019