Author: timbo
Date: Sat Jun 23 04:21:33 2007
New Revision: 9670

Modified:
   dbi/trunk/Changes
   dbi/trunk/t/40profile.t

Log:
Fixed t/40profile.t to use int(dbi_time()) for systems like Cygwin where
time() seems to be rounded not truncated from the high resolution time.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Sat Jun 23 04:21:33 2007
@@ -42,12 +42,14 @@
   Fixed code that triggered fatal error in bleadperl
     thanks to Steve Hay.
   Fixed compiler warning thanks to Jerry D. Hedden.
+  Fixed t/40profile.t to use int(dbi_time()) for systems like Cygwin where
+    time() seems to be rounded not truncated from the high resolution time.
 
 =head2 Changes in DBI 1.57 (svn rev 9639),  13th June 2007
 
   Note: this release includes a change to the DBI::hash() function which will
   now produce different values than before *if* your perl was built with 64-bit
-  'int' type (i.e. "perl -V:intsize" says intsize='4').  It's relatively rare
+  'int' type (i.e. "perl -V:intsize" says intsize='8').  It's relatively rare
   for perl to be configured that way, even on 64-bit systems.
 
   Fixed XS versions of select*_*() methods to call execute()

Modified: dbi/trunk/t/40profile.t
==============================================================================
--- dbi/trunk/t/40profile.t     (original)
+++ dbi/trunk/t/40profile.t     Sat Jun 23 04:21:33 2007
@@ -9,7 +9,7 @@
 
 use Config;
 use DBI::Profile;
-use DBI;
+use DBI qw(dbi_time);
 use Data::Dumper;
 use File::Spec;
 use Storable qw(dclone);
@@ -149,7 +149,7 @@
 ok($time1 >= $^T);
 ok($time2 >= $^T);
 ok($time1 <= $time2);
-my $next = time + 1;
+my $next = int(dbi_time()) + 1;
 ok($next > $time1) or warn "next $next > first $time1: failed\n";
 ok($next > $time2) or warn "next $next > last $time2: failed\n";
 if ($shortest < 0) {
@@ -286,15 +286,16 @@
 $dbh->{Profile}->{Path} = [ '!Time', "!Time~$factor", '!MethodName' ];
 $dbh->{Profile}->{Data} = undef;
 
-$t1 = time()+1; 1 while time() < $t1; # spin till new second starts
-$sth = $dbh->prepare("select name from .");
+$t1 = int(dbi_time())+1; 1 while int(dbi_time()) < $t1; # spin till new second 
starts
 $t2 = int($t1/$factor)*$factor;
 
+$sth = $dbh->prepare("select name from .");
+
 $tmp = sanitize_profile_data_nodes($dbh->{Profile}{Data});
-#warn Dumper($tmp);
 is_deeply $tmp, {
     $t1 => { $t2 => { prepare => [ 1, 0, 0, 0, 0, 0, 0 ] }}
-}, "!Time and !Time~$factor should work";
+}, "!Time and !Time~$factor should work"
+  or print Dumper($tmp);
 
 
 print "testing &norm_std_n3 in Path\n";

Reply via email to