X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,SARE_SUB_PCT_LETTER,TW_YG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4DA6B9BA.2020500@lysator.liu.se> Date: Thu, 14 Apr 2011 11:09:14 +0200 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: strftime trouble with %z Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 Hi! I'm getting somewhat troublesome output from the below STC. It seems as if gmtime mucks with something, or that localtime is not filling in everything it needs to? ------------------8<---(zone.c)--------- #include #include int main(void) { char zone[6]; struct tm *tm; time_t now = time(NULL); tm = localtime(&now); strftime(zone, sizeof(zone), "%z", tm); printf("%s %d %d\n", zone, timezone, tm->tm_isdst); tm = localtime(&now); strftime(zone, sizeof(zone), "%z", tm); printf("%s %d %d\n", zone, timezone, tm->tm_isdst); tm = gmtime(&now); tm = localtime(&now); strftime(zone, sizeof(zone), "%z", tm); printf("%s %d %d\n", zone, timezone, tm->tm_isdst); return 0; } ------------------8<-------------------- I expect three equal lines, e.g. +0200 -3600 1 +0200 -3600 1 +0200 -3600 1 but I get this on Cygwin: +0200 -3600 1 +0200 -3600 1 +0000 -3600 1 $ cygcheck -c gcc4 cygwin Cygwin Package Information Package Version Status cygwin 1.7.9-1 OK gcc4 4.3.4-4 OK FWIW, I have tested the STC on Linux and Solaris 10 and they behave as I expected... Cheers, Peter -- 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