diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-17 20:07:20 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-17 20:07:20 +0000 |
commit | 389199d8e578e8c2660c4fea3c0dd0bee7279ecb (patch) | |
tree | a333d15735ce220dec88c770a4a0000aaa32d729 | |
parent | 3b434eb14b7fab4ed6941403c71b683066ab60a2 (diff) | |
download | perl-389199d8e578e8c2660c4fea3c0dd0bee7279ecb.tar.gz |
Explain an apparent bug reported by
Richard J. Barbalace <rjbarbal@MIT.EDU>,
with additional explanation from Gisle Aas.
p4raw-id: //depot/perl@12059
-rw-r--r-- | ext/Time/HiRes/HiRes.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/Time/HiRes/HiRes.pm b/ext/Time/HiRes/HiRes.pm index f512145fff..e52d7eef99 100644 --- a/ext/Time/HiRes/HiRes.pm +++ b/ext/Time/HiRes/HiRes.pm @@ -127,6 +127,19 @@ Returns a floating seconds since the epoch. This function can be imported, resulting in a nice drop-in replacement for the C<time> provided with perl, see the EXAMPLES below. +B<NOTE>: Since Sunday, September 9th, 2001 at 01:46:40 AM GMT the +default floating point format of Perl and the seconds since epoch +have conspired to produce an apparent bug: if you print the value +of Time::HiRes::time() you seem to be getting only five decimals, +not six as promised (microseconds). Not to worry, the microseconds +are there (assuming your platform supports such granularity). +What is going on is that the default floating point format of Perl +only outputs 15 digits. In this case that means ten digits before the +decimal separator and five after. To see the microseconds you can use +either printf/sprintf with C<%.6f>, or the gettimeofday() function in +list context, which will give you the seconds and microseconds as two +separate values. + =item sleep ( $floating_seconds ) Converts $floating_seconds to microseconds and issues a usleep for the |