Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jun 2003 11:50:13 -0700 (PDT)
From:      Barry Pederson <bp@barryp.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/53899: mktime gives wrong result in Central timezone
Message-ID:  <200306291850.h5TIoDUM004200@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/53899; it has been noted by GNATS.

From: Barry Pederson <bp@barryp.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/53899: mktime gives wrong result in Central timezone
Date: Sun, 29 Jun 2003 13:46:49 -0500

 Here's a C equivalent to the Perl script
 that demonstrates the problem.  Compile with:
 
     gcc -o tzdemo tzdemo.c
 
 and alter the tzdemo.sh script to run ./tzdemo
 instead of tzdemo.pl
 
 The output is the same as before, which should
 rule out this being a Perl (or Python) problem.
 
 -------- tzdemo.c ------------
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 
 int main(int argc, char **argv)
      {
      struct tm test_gm;
      time_t result;
      time_t test_time = 1055176982;
 
      memset(&test_gm, 0, sizeof(test_gm));
      test_gm.tm_sec  = 2;
      test_gm.tm_min  = 43;
      test_gm.tm_hour = 16;
      test_gm.tm_mday = 9;
      test_gm.tm_mon  = 5;
      test_gm.tm_year = 103;
      test_gm.tm_wday = 1;
      test_gm.tm_yday = 159;
      test_gm.tm_isdst = 0;
 
      result = mktime(&test_gm);
 
      printf("%s %d %d\n", getenv("TZ"), (int) result,
           ((int)(result-test_time))/3600);
 
      return 0;
      }
 ---------------------------
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306291850.h5TIoDUM004200>