Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 chanting in the Monastery: (6)
As of 2020-12-02 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (35 votes). Check out past polls.

    Notices?