Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: MARKLE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.9719
Fixed in: (no value)



Subject: doesn't seem to work at all
Am I doing something wrong here? This takes zero seconds in Linux on both Debian Squeeze (perl 5.10.1) and CentOS 5.3 (perl 5.8.8). Is this unsupported in Linux? Because I have man pages for clock_nanosleep etc. --mark-- #!/usr/bin/perl use strict; use warnings FATAL => 'all'; use English '-no_match_vars'; use Time::HiRes qw( usleep ); my $start = time; usleep(1000 * 10); my $end = time; my $took = $end - $start; print "took $took seconds.\n";
Perhaps this is a problem like the man page suggests about clock differences if not in a "hard realtime" system. Only, it seems to be radically off. Is this something that a proper RTC driver could fix? Looks like my kernel on my Thinkpad isn't loading an RTC driver automatically, though I'm using the newest stock 2.6.32 kernel at the moment. Is this something where the documentation needs to be more verbose and emphatic about the conditions under which it will work? Thanks. --mark-- In Debian with 1000Mhz clock speed pre-emptive: maggie:~# ./lame.pl sleeping 30 minutes took 1 seconds. sleeping 60 minutes took 4 seconds. sleeping 120 minutes took 7 seconds. sleeping 240 minutes took 15 seconds. sleeping 480 minutes took 28 seconds. maggie:~# cat lame.pl #!/usr/bin/perl use strict; use warnings FATAL => 'all'; use English '-no_match_vars'; use Time::HiRes qw( usleep ); for my $min ( 30, 60, 60 * 2, 60 * 4, 60 * 8, ) { my $start = time; my $usecs = $min * 1000 * 60; usleep($usecs); my $end = time; my $took = $end - $start; print "sleeping $min minutes took $took seconds.\n"; }
Subject: Re: [rt.cpan.org #54238] doesn't seem to work at all
Date: Sat, 06 Feb 2010 18:19:11 -0500
To: bug-Time-HiRes [...] rt.cpan.org
From: Jarkko Hietaniemi <jhi [...] iki.fi>
On Friday-201002-05 19:21, Mark Hedges via RT wrote: Show quoted text
> #!/usr/bin/perl > > use strict; > use warnings FATAL => 'all'; > use English '-no_match_vars'; > > use Time::HiRes qw( usleep ); > > for my $min ( > 30, > 60, > 60 * 2, > 60 * 4, > 60 * 8, > ) { > my $start = time; > my $usecs = $min * 1000 * 60;
Ummm. You do know that usecs means microseconds, which means millionths of seconds? Show quoted text
> usleep($usecs); > my $end = time; > my $took = $end - $start; > print "sleeping $min minutes took $took seconds.\n"; > }
BIG TIME DUH
RT-Send-CC: jhi [...] iki.fi
i knew there was a reason i ended up studying philosophy...
Subject: Re: [rt.cpan.org #54238] sleeps radically less than expected
Date: Mon, 08 Feb 2010 13:52:02 -0500
To: bug-Time-HiRes [...] rt.cpan.org
From: Jarkko Hietaniemi <jhi [...] iki.fi>
On Sunday-201002-07 22:20, Mark Hedges via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=54238 > > > i knew there was a reason i ended up studying philosophy... >
No problem, I often run afoul the same thing.