strptime error when setting a different TimeZone with export TZ=UTC

Eric Blake ericblake@comcast.net
Fri Jun 24 19:33:00 GMT 2005


> 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/



More information about the Cygwin mailing list