Re: accuracy of Time::HiRes
- From: "John" <john1949@xxxxxxxxx>
- Date: Sat, 28 Jun 2008 06:54:40 +0100
"Anonymous coward" <anonymous@xxxxxxx> wrote in message
news:bdb84$48655840$89e0e08f$8931@xxxxxxxxxxxxxxxxxxx
On Fri, 27 Jun 2008 21:38:39 +0100, John wrote:
Hi
use Time::HiRes qw (gettimeofday);
my ($secs,$milliseconds)=gettimeofday(); my $trans="$secs$milliseconds";
# 10 digits and 6 digits
Sometimes the length of $trans is 16 but sometimes it is 15. Shouldn't
it be 16 always?
Regards
John
The length of microseconds (not milliseconds) will be 5 digits one out of
ten times, because it's value is less than 100000 microseconds. In one
out of a hundred times it will be 4 digits, etc. If you rely on the
length of it, you should probably use sprintf.
Regards,
Leon Timmermans
Hi
Of course, I see that now. I need the length to create a unique number of
standard length. sprintf will do that.
Many thanks.
Regards
John
.
- References:
- accuracy of Time::HiRes
- From: John
- Re: accuracy of Time::HiRes
- From: Anonymous coward
- accuracy of Time::HiRes
- Prev by Date: Re: Using System to read mixed cased environment variables on Windows
- Next by Date: Re: Perl search engine
- Previous by thread: Re: accuracy of Time::HiRes
- Next by thread: FAQ 9.23 How do I find out my hostname, domainname, or IP address?
- Index(es):
Relevant Pages
|