Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Convert time in seconds to hh::mm::ss

by Anonymous Monk
on Mar 16, 2016 at 01:26 UTC ( [id://1157884]=note: print w/replies, xml ) Need Help??


in reply to Convert time in seconds to hh::mm::ss

This works, but i have to do this a lot of times and wonder if there is a faster way, like a single calculation rather than my three here. Thanks for any help.

Did you measure how fast it takes?

See Devel::Profile, and then promptly forget about speeding up parse_duration

  • Comment on Re: Convert time in seconds to hh::mm::ss

Replies are listed 'Best First'.
Re^2: Convert time in seconds to hh::mm::ss
by bangor (Monk) on Mar 16, 2016 at 01:34 UTC
    - Did you measure how fast it takes?

    No I didn't, that Devel::NYTProf looks one serious module - thanks. I do know how to use Benchmark but would be good if I had some other method to compare this with. Any examples I found wanted to convert to days, hours, etc. but I need to keep to hours only.

    edit - Oh, I see what you mean - should be no need to worry, that's good.

      If you know how to benchmark, and you know that there's no translation of DST etc involved, why bother doing premature profiling? Unless you're doing this thousands of times per second, I see nothing wrong with this simple sub.

      What exactly is the issue here?

        - What exactly is the issue here?

        This is part of a web app where I call an external API and get back a few hundred results and have to do quite a few conversions. I can't speed up the API call so am looking to improve speed anywhere I can. Just thought this might be a likely candidate.
Re^2: Convert time in seconds to hh::mm::ss
by Anonymous Monk on Mar 16, 2016 at 01:27 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2026-04-20 12:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.