delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2013/07/26/15:09:49

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Message-ID: <51F2C9B5.3090202@gmx.de>
Date: Fri, 26 Jul 2013 21:10:45 +0200
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: zoneinfo not able to recognize if daylight saving time is in effect.
X-Provags-ID: V03:K0:+V5nAIMkJsyhjVEX97kJECewQZu7FV1D/fEzb3VnWZ2U6QfY+pz
oCfSuAqgdlZcnNKq3RCFro0nkTOGOWc/TUHNCwjIFYhbDG0NiOZm3oIPW9DfuUeKb8vI5QC
+3ll6O9JhPDl/Soh5Av5aZreOfaqeSZHE4i6wMLWSCJDyxSzePpxXQUrBYTMZ1zqvg+ZYY4
d0E0SORd5fBP1zjRDvl0g==
Reply-To: djgpp-workers AT delorie DOT com

Some days ago an user called my attention to the fact that neither the
zoneinfo support of djdev203 nor djdev204 nor the one from the repository
seems to work flawlessly.  See mail below.  I have verified that the
sample code works on my linux.  The first surprising fact is that there
is a behavior difference between djtzn203 and djtzn204/repository versions.
I have out-defined all the other calls to localtime except for the one
that differs.  Replacing New_York file from one version with the other
make the behavior swap.  This means that the sample program compiled
with 204 version now works OK with the NY file from 203 and the sample
program compiled with 203 fails with the NY file from 204/repository.
I am aware that the files are different.
OFYI, I have also cross-compiled the repository code.  The NY file I get
is broken the same way than the one compiled on windows.  It seems that using
host-zic from linux or windows does not make any difference.

Before I start stepping into the code to figure out what is broken here
I would ask if some one here remembers a reason why the zoneinfo support
is broken like this.
Have there been zic.exe or host-zic issues that have result in broken
data files, etc.?

See sample code and results.


TIA,
Juan M. Guerrero



---  mail start  ---
Betreff:
Re: DJGPP zoneinfo
Von:
David Flater <dave AT flaterco DOT com>
Datum:
25.07.2013 01:51
An:
Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>

On 07/23/2013 10:34 PM, David Flater wrote:
 > > For :America/New_York, we are in EDT now but it comes back as EST.

Test case and test results attached.

DWF


tztest.c
*/
/* Quick tz test by DWF 2013-07-24 19:11 */

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

#define buflen 80

void timetest (int *fail, time_t t, char er[buflen]) {
   char or[buflen];
   if (!strftime (or, buflen, "%Y-%m-%d %H:%M:%S %Z", localtime(&t))) {
     fprintf (stderr, "strftime failed   FAIL\n");
     exit (-1);
   }
   printf ("time_t %ld  expected %s\n", (long)t, er);
   printf ("                        got %s", or);
   if (strcmp(er,or)) *fail=1, printf("   FAIL");
   printf ("\n");
}

int main (int argc, char **argv) {
   int fail = 0;
   static char env_string[] = "TZ=:America/New_York";
   if (putenv(env_string)) {
     fprintf (stderr, "putenv failed   FAIL\n");
     exit (-1);
   }
   tzset();
#if 0
   timetest (&fail, 1357016400, "2013-01-01 00:00:00 EST");
   timetest (&fail, 1362898799, "2013-03-10 01:59:59 EST");
   timetest (&fail, 1362898800, "2013-03-10 03:00:00 EDT");
#endif
   timetest (&fail, 1372780800, "2013-07-02 12:00:00 EDT");
#if 0
   timetest (&fail, 1383454800, "2013-11-03 01:00:00 EDT");
   timetest (&fail, 1383458400, "2013-11-03 01:00:00 EST");
   timetest (&fail, 1388552399, "2013-12-31 23:59:59 EST");
#endif
   printf ("Test %s\n", (fail ? "FAILED" : "passed"));
   return 0;
}

/*
204cvs.txt

time_t 1357016400  expected 2013-01-01 00:00:00 EST
                         got 2013-01-01 00:00:00 EST
time_t 1362898799  expected 2013-03-10 01:59:59 EST
                         got 2013-03-10 01:59:59 EST
time_t 1362898800  expected 2013-03-10 03:00:00 EDT
                         got 2013-03-10 02:00:00 EST   FAIL
time_t 1372780800  expected 2013-07-02 12:00:00 EDT
                         got 2013-07-02 11:00:00 EST   FAIL
time_t 1383454800  expected 2013-11-03 01:00:00 EDT
                         got 2013-11-03 00:00:00 EST   FAIL
time_t 1383458400  expected 2013-11-03 01:00:00 EST
                         got 2013-11-03 01:00:00 EST
time_t 1388552399  expected 2013-12-31 23:59:59 EST
                         got 2013-12-31 23:59:59 EST
Test FAILED


203.txt

time_t 1357016400  expected 2013-01-01 00:00:00 EST
                         got 2013-01-01 00:00:00 EST
time_t 1362898799  expected 2013-03-10 01:59:59 EST
                         got 2013-03-10 01:59:59 EST
time_t 1362898800  expected 2013-03-10 03:00:00 EDT
                         got 2013-03-10 02:00:00 EST   FAIL
time_t 1372780800  expected 2013-07-02 12:00:00 EDT
                         got 2013-07-02 12:00:00 EDT
time_t 1383454800  expected 2013-11-03 01:00:00 EDT
                         got 2013-11-03 00:00:00 EST   FAIL
time_t 1383458400  expected 2013-11-03 01:00:00 EST
                         got 2013-11-03 01:00:00 EST
time_t 1388552399  expected 2013-12-31 23:59:59 EST
                         got 2013-12-31 23:59:59 EST
Test FAILED


slackware.txt

time_t 1357016400  expected 2013-01-01 00:00:00 EST
                         got 2013-01-01 00:00:00 EST
time_t 1362898799  expected 2013-03-10 01:59:59 EST
                         got 2013-03-10 01:59:59 EST
time_t 1362898800  expected 2013-03-10 03:00:00 EDT
                         got 2013-03-10 03:00:00 EDT
time_t 1372780800  expected 2013-07-02 12:00:00 EDT
                         got 2013-07-02 12:00:00 EDT
time_t 1383454800  expected 2013-11-03 01:00:00 EDT
                         got 2013-11-03 01:00:00 EDT
time_t 1383458400  expected 2013-11-03 01:00:00 EST
                         got 2013-11-03 01:00:00 EST
time_t 1388552399  expected 2013-12-31 23:59:59 EST
                         got 2013-12-31 23:59:59 EST
Test passed



tztest.c    1.2 KB
204cvs.txt    761 Bytes
203.txt    754 Bytes
slackware.txt    740 Bytes
---  mail end  ---

- Raw text -


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