Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > accuracy of Time::HiRes

Reply
Thread Tools

accuracy of Time::HiRes

 
 
John
Guest
Posts: n/a
 
      06-27-2008
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





 
Reply With Quote
 
 
 
 
John
Guest
Posts: n/a
 
      06-28-2008

"Anonymous coward" <(E-Mail Removed)> wrote in message
news:bdb84$48655840$89e0e08f$(E-Mail Removed) ...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accuracy and CSS =?Utf-8?B?Q2hhcmxlc0E=?= ASP .Net 5 01-17-2006 12:47 PM
[Newbie] Type conversion - Loss of accuracy PercyP Java 5 10-20-2004 07:04 PM
Measuring the colour accuracy of digital cameras andrew29@littlepinkcloud.invalid Digital Photography 4 06-18-2004 10:24 AM
Canon digital Rebel focus accuracy and Mirror shock test jriegle Digital Photography 1 02-06-2004 11:03 PM
Dimage Xt viewfinder accuracy? Matthew Halfant Digital Photography 2 08-19-2003 07:52 PM



Advertisments