Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Compact script for time difference in seconds

by McDarren (Abbot)
on Sep 17, 2009 at 08:08 UTC ( #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


Comment on Re: Compact script for time difference in seconds
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-09-03 02:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls