Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^5: The most precise second (timer)

by soonix (Canon)
on Nov 27, 2019 at 08:11 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11109299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-03-28 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found