delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/05/26/11:13:27

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199905260951.JAA10357@jaygrp.intelihealth.com>
To: cygwin AT sourceware DOT cygnus DOT com
cc: jacobson AT pobox DOT com
Subject: B20: mktime() assumes gmtime instead of localtime
Reply-To: Joseph Jacobson <jacobson AT pobox DOT com>
Date: Wed, 26 May 1999 09:51:02 +0000
From: Joe Jacobson <marauder AT jaygrp DOT intelihealth DOT com>

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 AT pobox DOT 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 AT sourceware DOT cygnus DOT com

- Raw text -


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