As the various recent test reports have indicated, everyone east of
Greenwich has been getting test failures with the "use vmsish qw(time)"
tests in [.lib]vmsish.t. I think I've found the problem, which I'm
pretty sure is something I introduced in the 5.8.0 timeframe. Basically
it's a scoping bug in the test where it invokes the pragma inside an
EVAL, but since the pragma is lexically scoped its influence does not
propagate outward to the code that expects it to be in effect. UTC time
and VMS time end up identical, but there were compensating errors that
caused this never to be noticed in timezones with a negative offset from
GMT.

I've a attached a patch that I think takes care of everything. Could
someone with a positive offset from GMT and any version of Perl 5.8.0 or
later try this out and let me know how it goes. TIA.


--- lib/vmsish.t;-0     Fri Jul 19 17:50:02 2002
+++ lib/vmsish.t        Mon Mar 24 15:15:30 2003
@@ -114,6 +114,10 @@
   }
   {
      use_ok('vmsish qw(time)');
+
+     # but that didn't get it in our current scope
+     use vmsish qw(time);
+
      $vmstime   = time;
      @vmslocal  = localtime($vmstime);
      @vmsgmtime = gmtime($vmstime);
@@ -130,23 +134,23 @@
   # since it's unlikely local time will differ from UTC by so small
   # an amount, and it renders the test resistant to delays from
   # things like stat() on a file mounted over a slow network link.
-  ok($utctime - $vmstime +$offset <= 10,"(time) UTC:$utctime VMS:$vmstime");
+  ok(abs($utctime - $vmstime + $offset) <= 10,"(time) UTC: $utctime VMS: $vmstime");
 
   $utcval = $utclocal[5] * 31536000 + $utclocal[7] * 86400 +
             $utclocal[2] * 3600     + $utclocal[1] * 60 + $utclocal[0];
   $vmsval = $vmslocal[5] * 31536000 + $vmslocal[7] * 86400 +
             $vmslocal[2] * 3600     + $vmslocal[1] * 60 + $vmslocal[0];
-  ok($vmsval - $utcval + $offset <= 10, "(localtime)");
+  ok(abs($vmsval - $utcval + $offset) <= 10, "(localtime) UTC: $utcval  VMS: 
$vmsval");
   print "# UTC: @utclocal\n# VMS: @vmslocal\n";
 
   $utcval = $utcgmtime[5] * 31536000 + $utcgmtime[7] * 86400 +
             $utcgmtime[2] * 3600     + $utcgmtime[1] * 60 + $utcgmtime[0];
   $vmsval = $vmsgmtime[5] * 31536000 + $vmsgmtime[7] * 86400 +
             $vmsgmtime[2] * 3600     + $vmsgmtime[1] * 60 + $vmsgmtime[0];
-  ok($vmsval - $utcval + $offset <= 10, "(gmtime)");
+  ok(abs($vmsval - $utcval + $offset) <= 10, "(gmtime) UTC: $utcval  VMS: $vmsval");
   print "# UTC: @utcgmtime\n# VMS: @vmsgmtime\n";
 
-  ok($vmsmtime - $utcmtime + $offset <= 10,"(stat) UTC: $utcmtime  VMS: $vmsmtime");
+  ok(abs($utcmtime - $vmsmtime + $offset) <= 10,"(stat) UTC: $utcmtime  VMS: 
$vmsmtime");
 }
 }
 

Reply via email to