From: Robin Barker Date: Tue, 24 Aug 1999 11:09:24 +0000 (+0100) Subject: Fix scalar gmtime (and localtime) in quad environments, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f5a29b03d6424b21aad3d841127a2c7b87eb6888;p=p5sagit%2Fp5-mst-13.2.git Fix scalar gmtime (and localtime) in quad environments, 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 --- diff --git a/pp_sys.c b/pp_sys.c index afac5ab..8c0820f 100644 --- 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) { diff --git a/t/op/time.t b/t/op/time.t index 1bec442..658f9f3 100755 --- a/t/op/time.t +++ b/t/op/time.t @@ -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";}