Skip to content

Commit a247abd

Browse files
committed
Merge pull request #6 from mbeijen/fix-87-async-win32
Made test t/87async.t not stop on Win32.
2 parents fff5b1d + 596b9e2 commit a247abd

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

t/87async.t

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use Test::Deep;
55
use Test::More;
66
use DBI;
77
use DBI::Const::GetInfoType;
8-
use Time::HiRes qw(clock_gettime CLOCK_REALTIME);
8+
use Time::HiRes;
99
use strict;
1010

1111
use vars qw($test_dsn $test_user $test_password);
@@ -43,25 +43,25 @@ my $rows;
4343
my $sth;
4444
my ( $a, $b, $c );
4545

46-
$start = clock_gettime(CLOCK_REALTIME);
46+
$start = Time::HiRes::gettimeofday();
4747
$rows = $dbh->do('INSERT INTO async_test VALUES (SLEEP(2), 0, 0)');
48-
$end = clock_gettime(CLOCK_REALTIME);
48+
$end = Time::HiRes::gettimeofday();
4949

5050
is $rows, 1;
5151
ok(($end - $start) >= 2);
5252

53-
$start = clock_gettime(CLOCK_REALTIME);
53+
$start = Time::HiRes::gettimeofday();
5454
$rows = $dbh->do('INSERT INTO async_test VALUES (SLEEP(2), 0, 0)', { async => 1 });
5555
ok defined($dbh->mysql_async_ready);
56-
$end = clock_gettime(CLOCK_REALTIME);
56+
$end = Time::HiRes::gettimeofday();
5757

5858
ok $rows;
5959
is $rows, '0E0';
6060

6161
ok(($end - $start) < 2);
6262

6363
sleep 1 until $dbh->mysql_async_ready;
64-
$end = clock_gettime(CLOCK_REALTIME);
64+
$end = Time::HiRes::gettimeofday();
6565
ok(($end - $start) >= 2);
6666

6767
$rows = $dbh->mysql_async_result;
@@ -75,17 +75,17 @@ is $rows, 2;
7575

7676
$dbh->do('DELETE FROM async_test');
7777

78-
$start = clock_gettime(CLOCK_REALTIME);
78+
$start = Time::HiRes::gettimeofday();
7979
$rows = $dbh->do('INSERT INTO async_test VALUES(SLEEP(2), ?, ?)', { async => 1 }, 1, 2);
80-
$end = clock_gettime(CLOCK_REALTIME);
80+
$end = Time::HiRes::gettimeofday();
8181

8282
ok $rows;
8383
is $rows, '0E0';
8484

8585
ok(($end - $start) < 2);
8686

8787
sleep 1 until $dbh->mysql_async_ready;
88-
$end = clock_gettime(CLOCK_REALTIME);
88+
$end = Time::HiRes::gettimeofday();
8989
ok(($end - $start) >= 2);
9090

9191
$rows = $dbh->mysql_async_result;
@@ -100,23 +100,23 @@ is $c, 2;
100100

101101
$sth = $dbh->prepare('SELECT SLEEP(2)');
102102
ok !defined($sth->mysql_async_ready);
103-
$start = clock_gettime(CLOCK_REALTIME);
103+
$start = Time::HiRes::gettimeofday();
104104
ok $sth->execute;
105-
$end = clock_gettime(CLOCK_REALTIME);
105+
$end = Time::HiRes::gettimeofday();
106106
ok(($end - $start) >= 2);
107107

108108
$sth = $dbh->prepare('SELECT SLEEP(2)', { async => 1 });
109109
ok !defined($sth->mysql_async_ready);
110-
$start = clock_gettime(CLOCK_REALTIME);
110+
$start = Time::HiRes::gettimeofday();
111111
ok $sth->execute;
112112
ok defined($sth->mysql_async_ready);
113-
$end = clock_gettime(CLOCK_REALTIME);
113+
$end = Time::HiRes::gettimeofday();
114114
ok(($end - $start) < 2);
115115

116116
sleep 1 until $sth->mysql_async_ready;
117117

118118
my $row = $sth->fetch;
119-
$end = clock_gettime(CLOCK_REALTIME);
119+
$end = Time::HiRes::gettimeofday();
120120
ok $row;
121121
is $row->[0], 0;
122122
ok(($end - $start) >= 2);
@@ -132,15 +132,15 @@ ok $dbh->errstr;
132132
$dbh->do('DELETE FROM async_test');
133133

134134
$sth = $dbh->prepare('INSERT INTO async_test VALUES(SLEEP(2), ?, ?)', { async => 1 });
135-
$start = clock_gettime(CLOCK_REALTIME);
135+
$start = Time::HiRes::gettimeofday();
136136
$rows = $sth->execute(1, 2);
137-
$end = clock_gettime(CLOCK_REALTIME);
137+
$end = Time::HiRes::gettimeofday();
138138
ok(($end - $start) < 2);
139139
ok $rows;
140140
is $rows, '0E0';
141141

142142
$rows = $sth->mysql_async_result;
143-
$end = clock_gettime(CLOCK_REALTIME);
143+
$end = Time::HiRes::gettimeofday();
144144
ok(($end - $start) >= 2);
145145
is $rows, 1;
146146

@@ -154,9 +154,9 @@ $sth = $dbh->prepare('INSERT INTO async_test VALUES(SLEEP(2), ?, ?)', { async =
154154
$rows = $dbh->do('INSERT INTO async_test VALUES(SLEEP(2), ?, ?)', undef, 1, 2);
155155
is $rows, 1;
156156

157-
$start = clock_gettime(CLOCK_REALTIME);
157+
$start = Time::HiRes::gettimeofday();
158158
$dbh->selectrow_array('SELECT SLEEP(2)', { async => 1 });
159-
$end = clock_gettime(CLOCK_REALTIME);
159+
$end = Time::HiRes::gettimeofday();
160160

161161
ok(($end - $start) >= 2);
162162
ok !defined($dbh->mysql_async_result);

0 commit comments

Comments
 (0)