delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/08/13:40:37

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Sun, 8 Feb 2004 10:40:15 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: cygwin AT cygwin DOT com
Subject: localtime_r not returning local time
Message-ID: <20040208184015.GB880@efn.org>
Mime-Version: 1.0
User-Agent: Mutt/1.4i
Organization: bs"d
X-IsSubscribed: yes

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=rt-3 DOT 0 DOT 8-26136-75339 DOT 11 DOT 8378531676315 AT perl DOT org

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019