delorie.com/archives/browse.cgi | search |
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:message-id:date:from:mime-version:to:subject | |
:references:in-reply-to:content-type:content-transfer-encoding; | |
q=dns; s=default; b=BAhISA4PQmbhJEBNRcHJYrYaBzhkP33ok3/sJzSjwYZ | |
WLYyMM3IgAvensYOkSVN0YqDp1PoPSb0LwjxslsAmgitptxyNwNQwe0f0bObdhER | |
IJM7i4IdBpdwesIlDI28vOEFaq74GcnZNvXMQs2VXSIz+ChO/QKY3wVq5NznMfqY | |
= | |
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:message-id:date:from:mime-version:to:subject | |
:references:in-reply-to:content-type:content-transfer-encoding; | |
s=default; bh=/5FqBW9NxLTFNfuCtgeJBtXK1go=; b=PNnlL4u13XCMpM+Xd | |
Nq5CF6k/uxWE5mj4qHPhunon8NkOyZpN8TdEHd4GTA8wd64pABS+sv99Bp4+MpjO | |
SIcC4foETnkgHQlHCWattzn1LonV5vDd4IHDAY23r2/25EqA34FpqXou1SfIu2ze | |
Uoqe7VDpulg2++5+w75yQXz8HU= | |
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=-1.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 |
X-HELO: | mailout04.t-online.de |
Message-ID: | <54B40549.1040804@t-online.de> |
Date: | Mon, 12 Jan 2015 18:32:57 +0100 |
From: | Christian Franke <Christian DOT Franke AT t-online DOT de> |
User-Agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 SeaMonkey/2.31 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Bug in strftime %z |
References: | <003701d01ba3$a444b5d0$ecce2170$@belarc.com> <54947202 DOT 3010007 AT t-online DOT de> <20150107215004 DOT GC4190 AT calimero DOT vinschen DOT de> <20150108152638 DOT GQ4190 AT calimero DOT vinschen DOT de> |
In-Reply-To: | <20150108152638.GQ4190@calimero.vinschen.de> |
X-IsSubscribed: | yes |
Corinna Vinschen wrote: > On Jan 7 22:50, Corinna Vinschen wrote: >> Hi Christian, >> >> >> thanks for the testcase! >> >> On Dec 19 19:44, Christian Franke wrote: >>> $ cat strftest.c >>> #include <time.h> >>> #include <stdio.h> >>> #include <stdlib.h> >>> >>> int main(int argc, char **argv) >>> { >>> time_t t = (argc > 1 ? atol(argv[1]) : time(NULL)); >>> struct tm *tm = localtime(&t); >>> char buf[100]; >>> strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %z (%Z)", tm); >>> printf("%s\n", buf); >>> return 0; >>> } >>> >>> $ gcc -o strftest strftest.c >>> >>> $ echo $TZ >>> Europe/Berlin >>> >>> $ ./strftest 1419010000 >>> 2014-12-19 18:26:40 +0200 (CET) >>> >>> $ ./strftest 1436200000 >>> 2015-07-06 18:26:40 +0053 (CEST) >> 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. >> >> While this fixes the problem for recent timestamps, it will probably >> fail for older timestamps when other dst rules were active. >> >> 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. %z now works as expected. Thanks, Christian -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |