delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/01/08/10:27:00

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=U1h4A0/TD/1jtSgn9kIcfxyWad9PPwKGcffFzb6l5plYvv/VdMie8
B2FXpZfiw4kUvfwT528OxI1qDKfrQqCmC3rR891NiGLivfu5Ipn9udiVnA6r6bae
81SaYomq3jMRD0V5b5KYKUa+lX/6Pt/Z+9Z+OFVSf9byAS+qJz4UgU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=NKFmpXZ3/nn1fub0emOpkc2INEw=; b=dALyZLApby/sGHngfBxF1Vvot0pP
1uTS7QzrUAuQ8U/4foc9/fT6HC0ajdeW0pQNVb0YOSSY888TS34IhhxghKXL4EnG
k/k0oSCCGWdVU2kbPbk48rLjhTxNb21tPwGR7zNcUbD4nbQNvgFnJJtN4tFeyqi3
4JAo6mm7RkwTjz8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Thu, 8 Jan 2015 16:26:38 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Bug in strftime %z (was: Possible defect in email.exe re: sent timestamp)
Message-ID: <20150108152638.GQ4190@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <003701d01ba3$a444b5d0$ecce2170$@belarc.com> <54947202 DOT 3010007 AT t-online DOT de> <20150107215004 DOT GC4190 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20150107215004.GC4190@calimero.vinschen.de>
User-Agent: Mutt/1.5.23 (2014-03-12)

--+S4DbcR7QPeSsP0V
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jan  7 22:50, Corinna Vinschen wrote:
> Hi Christian,
>=20
>=20
> thanks for the testcase!
>=20
> On Dec 19 19:44, Christian Franke wrote:
> > $ cat strftest.c
> > #include <time.h>
> > #include <stdio.h>
> > #include <stdlib.h>
> >=20
> > int main(int argc, char **argv)
> > {
> >   time_t t =3D (argc > 1 ? atol(argv[1]) : time(NULL));
> >   struct tm *tm =3D localtime(&t);
> >   char buf[100];
> >   strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %z (%Z)", tm);
> >   printf("%s\n", buf);
> >   return 0;
> > }
> >=20
> > $ gcc -o strftest strftest.c
> >=20
> > $ echo $TZ
> > Europe/Berlin
> >=20
> > $ ./strftest 1419010000
> > 2014-12-19 18:26:40 +0200 (CET)
> >=20
> > $ ./strftest 1436200000
> > 2015-07-06 18:26:40 +0053 (CEST)
>=20
> Surprisingly this is an old problem which exists in this form since 2011.
> Weird that nobody noticed it so far.  Or I missed earlier bug reports :}
> The underlying cause was that the info for std and dst offsets was taken
> from the wrong spot in the file.  The weird 0053 offset is a result of
> wrongly using the LMT offset for Europe/Berlin.
>=20
> While this fixes the problem for recent timestamps, it will probably
> fail for older timestamps when other dst rules were active.
>=20
> The latest Cygwin versions come with an extended struct tm which adds
> members tm_offset and tm_zone for newly built applications.  I'm working
> on a patch so strftime utilizes these members if they are available.
> I hope to get this finished tomorrow.

I uploaded a snapshot containing the fixes in tzload and strftime to
https://cygwin.com/snapshots/  Please give it a try.


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--+S4DbcR7QPeSsP0V
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUrqGuAAoJEPU2Bp2uRE+gd0gP+gOLyzOkheBw6SEYDMfQ8ka2
Qc8hMU/xzoFCwrkBVidlwHMB0CvLT2uo1ag8BQyX54WJIpQN76XMi79v6j3g3KM5
65deVFMPQSSEbMRSg4unEQfdI2/btUaoPwLL/07bxDstAWsyz2MkyFcYwzpGV1OT
du5F3ZmzEBRQKcYQ1gPCZ+aYZ/E0vD60BClWv2+lILQ1+aO3/xgy5Hrxh5sqlr/S
C9kvez4KNvM+r8cT1k8S5cK92zQO7ySC+C9gCTzE8ydqTksJeY22RcWQwrOaDg5G
IRjYMoCViA0f0Ee00du3lYGwAGfAF6tDwWf2mBuCBClvhO22NIYorTnOjNTWL8Bk
7vJYeg/hNrO20SkI4+wOOyzY0e3JJ97kKl+OLNfQuY0Nczwc4gEPo5QVsn7ny654
TdxZuU81Et5HoP/PpL6v2y0+pt4J2jIWSHuI4LprgbYt63eW1Zg9b9JJu2lnMVXA
n1Egvd00AGcRw+ZKqyPoZKjZIRj2eXVrnKBaDCUwqonwzF2shoHN9LQaIGU/yHba
fgDsEAPn0TrXWYxgDlFoEALKeBBg4q53en5bqAEi4rcAD5MDdqu8EGCLYE3U3WDA
9PZZCEKe6hVjyLHHqkdR3yCEeY7YBWYiSnHJNAuqfZVe8Gz8tyYfnd83K0RRxmwP
Q0qbyHW8cCE7kc7FIYcm
=vquz
-----END PGP SIGNATURE-----

--+S4DbcR7QPeSsP0V--

- Raw text -


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