Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Compact script for time difference in seconds

by McDarren (Abbot)
on Sep 17, 2009 at 08:08 UTC ( [id://795808]=note: print w/replies, xml ) Need Help??


in reply to Compact script for time difference in seconds

Hi :)

This is something I find I need quite often, and I usually do something like:

use Time::HiRes qw( time ); # If required my @t; $t[0]= time(); # do some stuff $t[1] = time(); my $diff = formatted_time_diff(@t); print "Processing took $diff seconds\n"; sub formatted_time_diff { return sprintf("%.2f", $_[1]-$_[0]) }

Hope this helps,
Darren

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-24 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found