From: grimmer AT nyx DOT cs DOT du DOT edu (Geoff Rimmer) Date: Sun, 9 May 1993 18:13:52 -0600 To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: timezone problem - help required! I'm having trouble with timezones with my DJGPP programs. The following program illustrates my point: -*-*-*-*-*-*-*-*-*-*-* START -*-*-*-*-*-*-*-*-*-* #include #include #include extern int main() { char *tz=getenv("TZ"); time_t t; if (tz) printf("TZ=\"%s\"\n",tz); else puts("TZ not set"); time(&t); printf("time() = %lu\n",(unsigned long)t); printf("localtime() = %s",ctime(&t)); printf("gmtime() = %s",asctime(gmtime(&t))); return 0; } -*-*-*-*-*-*-*-*-*-*-* END -*-*-*-*-*-*-*-*-*-* The current time is Mon May 10 00:47:14 1993, according to the output from the MSDOS 'time' command. The output of the above program compiled with DJGPP (2.2.2, 1.08) is as follows: TZ="GMT0BST" time() = 736991234 localtime() = Sun May 9 23:47:14 1993 gmtime() = Sun May 9 23:47:14 1993 In the UK we are currently on British Summer Time (BST) which is one hour ahead of Greenwich Mean Time (GMT). So, shouldn't localtime() return a time one hour later than gmtime()? That is, shouldn't localtime() show 'Mon May 10 00:47:14 1993'? Any help or pointers would be very much appreciated! Geoff -------------------------------------------+-------------------------------- | Geoff Rimmer calling from England | "I've always thought of going | | 011 -- 44 -\-- 562 -- 884497 HOME | back to a place where you can | | \- 21 -- 236 -\-- 7051 WORK | drink tea and sit on the | | (grimmer AT nyx DOT cs DOT du DOT edu) \- 2494 FAX | carpet" - Syd Barrett | -------------------------------------------+--------------------------------