summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIan Goodacre <Ian.Goodacre@xtra.co.nz>2009-03-25 08:39:11 -0500
committerSteve Peters <steve@fisharerojo.org>2009-03-25 08:39:11 -0500
commit036055ae9ae83cd5b00514419663540cb13fc21a (patch)
treebc742fb103c2c64205df79349b177108b11a390f /ext
parent9b33fb8e6c642ded0db0a0bb8945dd083127b56f (diff)
downloadperl-036055ae9ae83cd5b00514419663540cb13fc21a.tar.gz
[perl #63914] Time::Piece reports timezone incorrectly
Diffstat (limited to 'ext')
-rw-r--r--ext/Time-Piece/Piece.xs2
-rw-r--r--ext/Time-Piece/t/02core.t9
2 files changed, 9 insertions, 2 deletions
diff --git a/ext/Time-Piece/Piece.xs b/ext/Time-Piece/Piece.xs
index e20b6d41b4..e65f20c415 100644
--- a/ext/Time-Piece/Piece.xs
+++ b/ext/Time-Piece/Piece.xs
@@ -23,7 +23,7 @@ extern "C" {
* support is added and NETaa14816 is considered in full.
* It does not address tzname aspects of NETaa14816.
*/
-#if !defined(HAS_GNULIBC)
+#if defined(HAS_GNULIBC)
# ifndef STRUCT_TM_HASZONE
# define STRUCT_TM_HASZONE
# else
diff --git a/ext/Time-Piece/t/02core.t b/ext/Time-Piece/t/02core.t
index d02055833d..fb43038c8a 100644
--- a/ext/Time-Piece/t/02core.t
+++ b/ext/Time-Piece/t/02core.t
@@ -1,4 +1,4 @@
-use Test::More tests => 93;
+use Test::More tests => 95;
my $is_win32 = ($^O =~ /Win32/);
my $is_qnx = ($^O eq 'qnx');
@@ -47,6 +47,13 @@ cmp_ok($t->datetime, 'eq','2000-02-29T12:34:56');
cmp_ok($t->daylight_savings, '==', 0);
# ->tzoffset?
+{
+ local $ENV{TZ} = "EST";
+ my $lt = localtime;
+ cmp_ok(scalar($lt->tzoffset), 'eq', '-18000');
+ cmp_ok($lt->strftime("%z"), 'eq', '-0500');
+}
+
cmp_ok(($t->julian_day / 2451604.0243 ) - 1, '<', 0.001);
cmp_ok(($t->mjd / 51603.52426) - 1, '<', 0.001);
cmp_ok($t->week, '==', 9);