Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: The most precise second (timer)

by soonix (Canon)
on Nov 27, 2019 at 08:11 UTC ( #11109299=note: print w/replies, xml ) Need Help??


in reply to Re^4: The most precise second (timer)
in thread The most precise second (timer)

the different length of your results, and especially the trailing "M" in the last line made me suspect gettimeofday doesn't return integers. A look into Time::HiRes confirms
gettimeofday ()
In array context returns a two-element array with the seconds and microseconds since the epoch. In scalar context returns floating seconds like Time::HiRes::time()
print evaluates its arguments in array context. So you could either change $, ($OUTPUT_FIELD_SEPARATOR) to somethng visible, or force scalar context by printing scalar gettimeofday or gettimeofday+0.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11109299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2020-05-24 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (142 votes). Check out past polls.

    Notices?