|
Posted by John on June 28, 2008, 1:54 am
Please log in for more thread options
> 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
|