defined @array and defined %hash need no warnings 'deprecated';
[p5sagit/p5-mst-13.2.git] / t / op / time.t
old mode 100755 (executable)
new mode 100644 (file)
index 00c5b05..0f2dd66
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 42;
+plan tests => 44;
 
 ($beguser,$begsys) = times;
 
@@ -44,7 +44,7 @@ ok(localtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ ]
 SKIP: {
     # This conditional of "No tzset()" is stolen from ext/POSIX/t/time.t
     skip "No tzset()", 1
-        if $^O eq "MacOS" || $^O eq "VMS" || $^O eq "cygwin" ||
+        if $^O eq "VMS" || $^O eq "cygwin" ||
            $^O eq "djgpp" || $^O eq "MSWin32" || $^O eq "dos" ||
            $^O eq "interix";
 
@@ -81,8 +81,9 @@ ok(gmtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ ]
 
 # Test gmtime over a range of times.
 {
-    # gm/localtime should go all the way from -2**63 to 2**63-1
-    # but floating point hacks mean it gets unreliable for large numbers.
+    # The range should be limited only by the 53-bit mantissa of an IEEE double (or 
+    # whatever kind of double you've got).  Here we just prove that we're comfortably 
+    # beyond the range possible with 32-bit time_t.
     my %tests = (
         # time_t         gmtime list                          scalar
         -2**35  => [52, 13, 20, 7, 2, -1019, 5, 65, 0, "Fri Mar  7 20:13:52 881"],
@@ -130,3 +131,17 @@ ok(gmtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ ]
         like scalar localtime($time), $scalar,       "  scalar";
     }
 }
+
+# Test floating point args
+{
+    eval {
+        $SIG{__WARN__} = sub { die @_; };
+        localtime(1.23);
+    };
+    is($@, '', 'Ignore fractional time');
+    eval {
+        $SIG{__WARN__} = sub { die @_; };
+        gmtime(1.23);
+    };
+    is($@, '', 'Ignore fractional time');
+}