www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/12/08:26:34

Date: Wed, 12 Apr 2000 10:09:58 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Larry Olin Horn <hornlo AT millsaps DOT edu>
cc: djgpp AT delorie DOT com
Subject: Re: timezone problems: tm_isdst not set; strftime("%z") is -0000
In-Reply-To: <200004111359.JAA06219@delorie.com>
Message-ID: <Pine.SUN.3.91.1000412100940.16084J-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 11 Apr 2000, Larry Olin Horn wrote:

> version: DJGPP 2.03 on Win98SE
> environment: TZ=CST6CDT (also tried with c:/djgpp/zoneinfo/CDT6CDT)
> 
> problems:
> 
>     tm_isdst is not set correctly
> 
>     strftime "%z" (lowercase "z") shows -0000 offset
>              ("%Z", upcase, shows "CDT")

I cannot reproduce the first problem.  Please always make a point of
posting a short test program that can be used to reproduce and dig
into any effects you think are abnormal, and the instructions to
compile, link and run that test program.

The short program below seems to work for me in my timezone.

Is the value of the TZ environment variable set in DJGPP.ENV or in the
environment?

In any case, %z is a non-ANSI format, and it isn't even documented in
the DJGPP library reference.  So I wonder how did you come about using
it.

>   %a, %d %b %Y %H:%M:%S %Z --> Tue, 11 Apr 2000 09:50:47 CST

I don't see any problem with this behavior.  If you think there is a
problem, please explain what it is.

Here's the test program I used:

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

int main(void)
{
  char str[200];
  time_t local_time = time (NULL);

  strftime (str, sizeof(str) - 1, "%a, %d %b %Y %H:%M:%S %z",
	    localtime (&local_time));
  printf ("%s\n", str);
  strftime (str, sizeof(str) - 1, "%a, %d %b %Y %H:%M:%S %Z",
	    localtime (&local_time));
  printf ("%s\n", str);
  return 0;
}

- Raw text -


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