Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 From: ericblake AT comcast DOT net (Eric Blake) To: Luca Wullschleger , cygwin AT cygwin DOT com Subject: Re: strptime error when setting a different TimeZone with export TZ=UTC Date: Fri, 24 Jun 2005 19:22:28 +0000 Message-Id: <062420051922.21338.42BC5D740007B14A0000535A22007358340A050E040D0C079D0A@comcast.net> X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0 > I would like to be able to parse the date in UTC, but it seams that either > the strptime or the mktime function do not like the modification of the TZ > environment variable. > > I also tried to printout the broken-down date structure try and it seams to > be correct, so I suppose that the problem is with the mktime() function. I > know this mktime() function uses some timezone settings from somewhere. > > I executed this peace of code on a Linux machine and the behaviour is right. > It seams that the problem only occurs within Cygwin. > > I tried everything, google searched it, but I found nothing interesting. There is a known problem in the interaction of newlib and cygwin, such that functions that are required by POSIX to behave as though they call tzset() haven't yet been implemented to do so. The workaround is to manually call tzset() yourself any time (pun not intended) you want to change the TZ environment variable in your C program (or better yet, to submit a patch to cygwin and/or newlib to fix ctime() , localtime() , mktime() , and strftime() to all call tzset() properly). http://cygwin.com/faq/faq_3.html#SEC85 -- Eric Blake -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/