Skip Menu |

This queue is for tickets about the Time-HiRes CPAN distribution.

Report information
The Basics
Id: 15552
Status: resolved
Priority: 0/
Queue: Time-HiRes

People
Owner: Nobody in particular
Requestors: r.kobes [...] uwinnipeg.ca
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.81
Fixed in: (no value)



Subject: undefined usleep() on Win32 in tests
On Win32 (ActivePerl 802), in running the tests for Time-HiRes version 1.81, I get an error Undefined subroutine &main::usleep called at t/HiRes.t line 356 which results in tests 21-31 failing. I'm not sure if this is the desired fix, but in the attached patch the fully qualified Time::HiRes::usleep() is used instead in t/HiRes.t.
--- HiRes.t~ Sat Nov 5 03:25:20 2005 +++ HiRes.t Sat Nov 5 15:36:18 2005 @@ -353,7 +353,7 @@ } $t0 = gettimeofday(); - $a = abs(usleep($sleep * 1E6) / ($sleep * 1E6) - 1.0); + $a = abs(Time::HiRes::usleep($sleep * 1E6) / ($sleep * 1E6) - 1.0); $td = gettimeofday() - $t0; $ratio = 1.0 + $a; @@ -398,7 +398,7 @@ print $@ =~ /::sleep\(-1\): negative time not invented yet/ ? "ok 24\n" : "not ok 24\n"; -eval { usleep(-2) }; +eval { Time::HiRes::usleep(-2) }; print $@ =~ /::usleep\(-2\): negative time not invented yet/ ? "ok 25\n" : "not ok 25\n";
Date: Sun, 06 Nov 2005 01:17:47 +0200
From: Jarkko Hietaniemi <jhietaniemi [...] gmail.com>
To: bug-Time-HiRes [...] rt.cpan.org
Subject: Re: [cpan #15552] undefined usleep() on Win32 in tests
RT-Send-Cc:
via RT wrote: Show quoted text
> This message about Time-HiRes was sent to you by RKOBES <RKOBES@cpan.org> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=15552 > > > On Win32 (ActivePerl 802), in running the tests for Time-HiRes > version 1.81, I get an error > Undefined subroutine &main::usleep called at t/HiRes.t line 356 > which results in tests 21-31 failing. I'm not sure if this is > the desired fix, but in the attached patch the fully qualified > Time::HiRes::usleep() is used instead in t/HiRes.t.
Would the attached version work? (It's a PRERELEASE version of 1.82.)
Download Time-HiRes-1.82.tar.gz
application/x-gzip 65.1k

Message body not shown because it is not plain text.

From: r.kobes [...] uwinnipeg.ca
[jhi@iki.fi - Sat Nov 5 18:18:30 2005]: Show quoted text
> via RT wrote:
> > This message about Time-HiRes was sent to you by RKOBES
> <RKOBES@cpan.org> via rt.cpan.org
> > > > Full context and any attached attachments can be found at: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=15552 > > > > > On Win32 (ActivePerl 802), in running the tests for Time-HiRes > > version 1.81, I get an error > > Undefined subroutine &main::usleep called at t/HiRes.t line 356 > > which results in tests 21-31 failing. I'm not sure if this is > > the desired fix, but in the attached patch the fully qualified > > Time::HiRes::usleep() is used instead in t/HiRes.t.
> > Would the attached version work? (It's a PRERELEASE version of 1.82.)
This version leads to the error t/HiRes....Time::HiRes::usleep(): unimplemented in this platform at t/HiRes.t line 145 I think this is coming from the import() sub of HiRes.pm, which tests for &d_usleep. This I don't think gets defined, as in const-c.inc (around line 262), HAS_USLEEP has to be defined in order for this to return 1. However, at the point that const-c.inc is included in HiRes.xs (line 80), HAS_USLEEP hasn't been defined yet (this occurs for Win32 at line 412 of HiRes.xs). I'm not sure the best place to include const-c.inc; the attached patch moves it later on in HiRes.xs, and with it, all tests pass for me.
--- HiRes.xs~ Sat Nov 5 15:45:22 2005 +++ HiRes.xs Sun Nov 6 00:54:20 2005 @@ -77,8 +77,6 @@ #endif /* #if defined(TIME_HIRES_CLOCK_GETTIME) && defined(_STRUCT_ITIMERSPEC) */ -#include "const-c.inc" - #if defined(WIN32) || defined(CYGWIN_WITH_W32API) #ifndef HAS_GETTIMEOFDAY @@ -689,6 +687,8 @@ } #endif /* #ifdef HAS_GETTIMEOFDAY */ + +#include "const-c.inc" MODULE = Time::HiRes PACKAGE = Time::HiRes