Subject: localtime_r not returning local time
From: Yitzchak Scott-Thoennes <[email-masked]>
To: [email-masked]
Date: Sun, 8 Feb 2004 10:40:15 -0800

localtime_r is (if no direct or indirect call to tzset has been made)
returning UTC time.

This is the source of the cygwin perl bug where perl's localtime() is
returning UTC time.  See:
http://groups.google.com/groups?selm=[email-masked]

Perl does not ever directly call tzset (except when perl code calls
POSIX::tzset).  Should it do so (at least at startup), or should
localtime_r be returning a TZ-based time even when tzset hasn't been
called?

My reading of susv3:
   "Local timezone information is used as though localtime() calls tzset().

   The relationship between a time in seconds since the Epoch used as
   an argument to localtime() and the tm structure (defined in the
   <time.h> header) is that the result shall be...corrected for timezone
   and any seasonal time adjustments...

   The same relationship shall apply for localtime_r(). 
   ...
   Unlike localtime(), the reentrant version is not required to set
   tzname.

is that while localtime_r need not (should not?) set the daylight,
timezone, and tzname globals, it should still use local time as if
tzset had been called.  Admittedly, the standard is vague on this
point.

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