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=i6GDrAqMEXISaT1pfnZv8j7A/Uz2B/azhcimQrX43v/ H1AYJom7J8MIQBG5lysh/NWzXbBuqwg3WjourgIpCra7bd7ooZo7VKqHsnfj+paV M5Mw0FmOTFbL+SEXQ690GNVk05OH+9IzFqZq26pjbCyef+AKnN8fSXyM3RTffKNk = 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=IhXfPbIPiNxoQGXGoCgvQ1W46BY=; b=xkVjDv5/qoGvMg9DR kELj1pDIVL5RSG2BV72HH2oQ0sfXbSgHXVsjnB4gsWjSrMUIJuHzLS8ljzrZinDo EWXb9XBt/pdyJH5u3Qyd4xtxUnezK7DxkVnWCb40E/uxhWiAwOmYz14l+M3eYmD+ oqcPHgxTsu5uLmV7L8apS9ATGc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout08.t-online.de Message-ID: <54947202.3010007@t-online.de> Date: Fri, 19 Dec 2014 19:44:18 +0100 From: Christian Franke 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 (was: Possible defect in email.exe re: sent timestamp) References: <003701d01ba3$a444b5d0$ecce2170$@belarc.com> In-Reply-To: <003701d01ba3$a444b5d0$ecce2170$@belarc.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Richard DeFuria wrote: > Hello, > > I noticed a defect in the latest cygwin email.exe tool. > > The defect is that the SENT timestamp is 1 hour off (i.e., one hour too > "old" compared to the current system time). > > My current email.exe version is as follows: > $ email -v > email - By Dean Jones; Version 3.2.0-git > > When I send an email using this tool (through my internal smtp server, which > is unchanged), the SENT timestamp is 1 hour old. > > When I send an email (via the same command line invocation) from an older > box using an older version of this tool, the SENT timestamp is correct. > > ... > TZ is unchanged, but it set as follows on both systems: > $ echo $TZ > America/New_York > > Is there anything you recommend I check? > > This seems to have cropped up after my 12/15/2014 update of cygwin. The email tool use strftime() to format the "Date" header line. There is apparently a bug in the implementation of "%z" (offset from UTC) format in recent Cygwin strftime(). Affected are latest release and test versions of Cygwin: Testcase: $ uname -srvm CYGWIN_NT-6.1-WOW64 1.7.33-2(0.280/5/3) 2014-11-13 15:45 i686 Cygwin # (and also 1.7.34-003) $ cat strftest.c #include #include #include 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) GNU date(1) uses its own implementation and works as expected: $ date '+%Y-%m-%d %H:%M:%S %z (%Z)' -d @1419010000 2014-12-19 18:26:40 +0100 (CET) $ date '+%Y-%m-%d %H:%M:%S %z (%Z)' -d @1436200000 2015-07-06 18:26:40 +0200 (CEST) Possible workaround: Avoid timezone names, used timezone spec instead: $ export TZ=CET-1CEST,M3.5.0/2,M10.5.0/2 $ ./strftest 1419010000 2014-12-19 18:26:40 +0100 (CET) $ ./strftest 1436200000 2015-07-06 18:26:40 +0200 (CEST) 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