Fix scalar gmtime (and localtime) in quad environments,
Robin Barker [Tue, 24 Aug 1999 11:09:24 +0000 (12:09 +0100)]
bug reported by Robin Barker.
To: jhi@iki.fi
Cc: perl5-porters@perl.org
Subject: Re: [ID 19990823.009] [PATCH perl5.005_61] typo in perl.h
Message-Id: <199908241009.LAA24394@tempest.npl.co.uk>

p4raw-id: //depot/cfgperl@4045

pp_sys.c
t/op/time.t

index afac5ab..8c0820f 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3940,13 +3940,13 @@ PP(pp_gmtime)
        if (!tmbuf)
            RETPUSHUNDEF;
        tsv = Perl_newSVpvf(aTHX_ "%s %s %2d %02d:%02d:%02d %d",
-                      dayname[tmbuf->tm_wday],
-                      monname[tmbuf->tm_mon],
-                      tmbuf->tm_mday,
-                      tmbuf->tm_hour,
-                      tmbuf->tm_min,
-                      tmbuf->tm_sec,
-                      tmbuf->tm_year + 1900);
+                           dayname[tmbuf->tm_wday],
+                           monname[tmbuf->tm_mon],
+                           (IV)tmbuf->tm_mday,
+                           (IV)tmbuf->tm_hour,
+                           (IV)tmbuf->tm_min,
+                           (IV)tmbuf->tm_sec,
+                           (IV)tmbuf->tm_year + 1900);
        PUSHs(sv_2mortal(tsv));
     }
     else if (tmbuf) {
index 1bec442..658f9f3 100755 (executable)
@@ -2,7 +2,7 @@
 
 # $RCSfile: time.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:32 $
 
-if ($does_gmtime = gmtime(time)) { print "1..5\n" }
+if ($does_gmtime = gmtime(time)) { print "1..6\n" }
 else { print "1..3\n" }
 
 ($beguser,$begsys) = times;
@@ -45,3 +45,9 @@ if (index(" :0:1:-1:364:365:-364:-365:",':' . ($localyday - $yday) . ':') > 0)
     {print "ok 5\n";}
 else
     {print "not ok 5\n";}
+
+# This could be stricter.
+if (gmtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Nov|Dec) ([ \d]\d) (\d\d):(\d\d):(\d\d) (\d\d\d\d)$/)
+    {print "ok 6\n";}
+else
+    {print "not ok 6\n";}