Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks
I'm trying to get the timestamp of subrotine before and after its execution and determine its duration.
Currently, I'm doing this:
$time_start = strftime("%H:%M:%S", localtime(time)); &my_rotine(); $time_end = strftime("%H:%M:%S", localtime(time)); $duration = $time_end - $time_start;
However, i get a warning:
Argument "13:13:13" isn't numeric in subtration.But the result is:
Start = 13:13:13 ; End = 13:13:15 ; Duration = 2Is there a better way to do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Operations with strftime
by Corion (Patriarch) on Jun 17, 2014 at 11:06 UTC | |
by perlfan (Parson) on Jun 17, 2014 at 14:08 UTC | |
|
Re: Operations with strftime
by parv (Parson) on Jun 17, 2014 at 11:19 UTC | |
|
Re: Operations with strftime
by Anonymous Monk on Jun 17, 2014 at 11:08 UTC |