accuracy of Time::HiRes

J

John

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
 
J

John

Anonymous coward said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top