From: Ilya Zakharevich Date: Thu, 18 Sep 2003 11:02:02 +0000 (-0700) Subject: -M -A -C broken X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a80d47c2f481402c370d7113267069d0c75ceeeb;p=p5sagit%2Fp5-mst-13.2.git -M -A -C broken Message-ID: <20030918180202.GA21949@math.berkeley.edu> (use stat.t instead of time.t) p4raw-id: //depot/perl@21277 --- diff --git a/os2/os2ish.h b/os2/os2ish.h index 7825c93..3ff25f2 100644 --- a/os2/os2ish.h +++ b/os2/os2ish.h @@ -14,6 +14,11 @@ */ #define HAS_UTIME /**/ +/* BIG_TIME: + * This symbol is defined if Time_t is an unsigned type on this system. + */ +#define BIG_TIME + #define HAS_KILL #define HAS_WAIT #define HAS_DLERROR diff --git a/pp_sys.c b/pp_sys.c index 0a3c95e..8c9c3cc 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3084,7 +3084,7 @@ PP(pp_ftmtime) dSP; dTARGET; if (result < 0) RETPUSHUNDEF; - PUSHn( (PL_basetime - PL_statcache.st_mtime) / 86400.0 ); + PUSHn( (((NV)PL_basetime - PL_statcache.st_mtime)) / 86400.0 ); RETURN; } @@ -3094,7 +3094,7 @@ PP(pp_ftatime) dSP; dTARGET; if (result < 0) RETPUSHUNDEF; - PUSHn( (PL_basetime - PL_statcache.st_atime) / 86400.0 ); + PUSHn( (((NV)PL_basetime - PL_statcache.st_atime)) / 86400.0 ); RETURN; } @@ -3104,7 +3104,7 @@ PP(pp_ftctime) dSP; dTARGET; if (result < 0) RETPUSHUNDEF; - PUSHn( (PL_basetime - PL_statcache.st_ctime) / 86400.0 ); + PUSHn( (((NV)PL_basetime - PL_statcache.st_ctime)) / 86400.0 ); RETURN; } diff --git a/t/op/stat.t b/t/op/stat.t index 69caf8c..b863f98 100755 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -9,7 +9,7 @@ BEGIN { use Config; use File::Spec; -plan tests => 73; +plan tests => 78; my $Perl = which_perl(); @@ -427,6 +427,21 @@ SKIP: { unlink $linkname or print "# unlink $linkname failed: $!\n"; } +print "# Zzz...\n"; +sleep(3); +my $f = 'tstamp.tmp'; +unlink $f; +ok (open(S, "> $f"), 'can create tmp file'); +close S or die; +my @a = stat $f; +print "# time=$^T, stat=(@a)\n"; +my @b = (-M _, -A _, -C _); +print "# -MAC=(@b)\n"; +ok( (-M _) < 0, 'negative -M works'); +ok( (-A _) < 0, 'negative -A works'); +ok( (-C _) < 0, 'negative -C works'); +ok(unlink($f), 'unlink tmp file'); + END { 1 while unlink $tmpfile; }