in reply to Operations with strftime

Strings do not work in subtraction.

Maybe consider reading time to find out what the function returns. After that, it should be trivial to find out how to get the time taken.

Update: ambrus found it for me - the most roundabout way to get an epoch timestamp would be

strftime( '%s', localtime( time ))

... but that's just identical to time().

Replies are listed 'Best First'.
Re^2: Operations with strftime
by perlfan (Parson) on Jun 17, 2014 at 14:08 UTC
    FWIW, strftime is damn handy for date subtraction and addition if you don't want to use heavy weighted modules like DateTime. I've had great success with it, see for more information:

    How Do I Get Yesterday's Date Using localtime.

    So in this case, strftime would be more useful if you had a date/time and an interval to add/subtract. There are many other modules and benchmarks for benchmarking. brian_d_foy has a great section on Benchmarking in his Mastering Perl book.

    For higher level profiling, you should look at Devel::NYTProf.