develooper Front page | perl.perl5.porters | Postings from March 2007

Different isdst default for POSIX::mktime vs. strftime

Thread Next
From:
Mike Schilli
Date:
March 14, 2007 11:40
Subject:
Different isdst default for POSIX::mktime vs. strftime
Message ID:
20070314103004.W23134@spiral.corp.yahoo.com
Hi p5p,

ext/POSIX/POSIX.xs comes with two different "isdst" defaults for
mktime() and strftime().

In mktime(), it assumes isdst=0 (meaning that Daylight Savings Time
is *not* in effect), whereas in strftime(), it defaults to
isdst=-1 (meaning that it will run its own investigation to figure
out whether DST is on or off).

Think it would make sense to implement a consistent policy of
isdst=-1 for both functions, defaulting to letting them figure out
whether DST is active or not as opposed to setting it to a hard "off".

Patch:

--- POSIX.xs.old        Wed Mar 14 11:24:54 2007
+++ POSIX.xs    Wed Mar 14 11:25:32 2007
@@ -1767,7 +1767,7 @@
        Time_t          time2

 SysRetLong
-mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
+mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1)
        int             sec
        int             min
        int             hour

-- Mike

Mike Schilli
m@perlmeister.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About