Date: Tue, 15 Sep 92 18:33:54 PDT From: Paul DOT Loewenstein AT Eng DOT Sun DOT COM (Paul Loewenstein) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Bug in time There appears to be a bug in version 1.08 time. It gives a result which is one hour slow. When the system date is set to winter (I forget which date I used), the problem went away. Running the following program under djgpp and turbo C gave the following results: #include void main() { long rawtime; rawtime = time((long *) 0); printf (asctime(localtime(&rawtime))); } DJGPP: C:\TEMP>go32 test c:/gcc/bin/go32.exe version 1.08 Copyright (C) 1991 DJ Delorie Mon Sep 14 20:19:36 1992 TURBO C: C:\TEMP>test Mon Sep 14 21:20:05 1992 The following program was run (less the last two fields for turbo C). It would appear that turbo C is subtracting an hour to compensate for summer time, and djgpp is not adding it back again. I leave any corrections to you. #include void main() { long rawtime; struct tm *lt; rawtime = time((long *) 0); lt = localtime(&rawtime); printf ("rawtime: %d\n", rawtime); printf ("tm_sec: %d\n",lt->tm_sec); printf ("tm_min: %d\n",lt->tm_min); printf ("tm_hour: %d\n",lt->tm_hour); printf ("tm_mday: %d\n",lt->tm_mday); printf ("tm_mon: %d\n",lt->tm_mon); printf ("tm_wday: %d\n",lt->tm_wday); printf ("tm_yday: %d\n",lt->tm_yday); printf ("tm_isdst: %d\n",lt->tm_isdst); printf ("tm_gmtoff: %d\n",lt->tm_gmtoff); printf ("tm_zone: %s\n",lt->tm_zone); } DJGPP: c:/gcc/bin/go32.exe version 1.08 Copyright (C) 1991 DJ Delorie rawtime: 716594677 tm_sec: 37 tm_min: 4 tm_hour: 17 tm_mday: 15 tm_mon: 8 tm_wday: 2 tm_yday: 258 tm_isdst: 0 tm_gmtoff: -18000 tm_zone: EST TCC: (the raw time does not correspond to their documentation) rawtime: 24155 tm_sec: 19 tm_min: 6 tm_hour: 18 tm_mday: 15 tm_mon: 8 tm_wday: 2 tm_yday: 258 tm_isdst: 1