This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

B20: mktime() assumes gmtime instead of localtime


NT 4.0 using Beta 20.0:

#include <stdio.h>
#include <time.h>

main(int argc,char* argv[]) {
  time_t t;
  struct tm* localT;
  struct tm* gmT;

  t = time(NULL);
  printf("Time = %ld\n",t);

  localT = localtime(&t);
  printf("Localtime = %s",asctime(localT));
  printf("Mktime = %ld\n",mktime(localT));

  gmT = gmtime(&t);
  printf("GMtime = %s",asctime(gmT));
  printf("Mktime = %ld\n",mktime(gmT));
}

under CYGWIN returns:
Time = 927731433
Localtime = Wed May 26 11:10:33 1999
Mktime = 927717033
GMtime = Wed May 26 15:10:33 1999
Mktime = 927731433

Using MS tools:
Time = 927731475
Localtime = Wed May 26 11:11:15 1999
Mktime = 927731475
GMtime = Wed May 26 15:11:15 1999
Mktime = 927745875


--
Joseph Jacobson <jacobson@pobox.com>    Finger for PGP
#include <std/disclaimer.h>
Two men walk into a bar.  The third one ducks.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]