Date: Tue, 21 Jun 1994 01:44:27 -0400 From: meetze AT charlie DOT ece DOT scarolina DOT edu (Murle C. Meetze III) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: gmtime, ctime and localtime functinons Cc: meetze AT charlie DOT ece DOT scarolina DOT edu I wrote the following program to test the gmtime, ctime and localtime functions: #include #include void main(void) { time_t a; struct tm *b, *c; time(&a); printf("ctime function returns:\n%s\n",ctime(&a)); b = gmtime(&a); c = localtime(&a); printf("gmttime function returns:\n%s\n",asctime(b)); printf("localtime function returns:\n%s\n",asctime(c)); } And here is the output I got on my PC: ctime function returns: Mon Jun 20 11:04:25 1994 gmttime function returns: Mon Jun 20 16:04:25 1994 localtime function returns: Mon Jun 20 11:04:25 1994 And the same program run on a Unix system output: ctime function returns: Mon Jun 20 11:52:13 1994 gmttime function returns: Mon Jun 20 11:52:13 1994 localtime function returns: Mon Jun 20 11:52:13 1994 Both were run close to the same time. The correct time here now is Mon Jun 20 11:52 1994. My clocks are set 15 mins. ahead of time, so the actual difference is about 1 hour slower. But when I run time on my PC I get the correct time. Is there a bug in the ctime and localtime functions? MCMIII Murle Cleveland Meetze III meetze AT charlie DOT ece DOT scarolina DOT edu