|Syntactic Confectionery Delight|
Date/Time Arithmeticby newbie01.perl (Sexton)
|on Nov 27, 2009 at 10:30 UTC||Need Help??|
newbie01.perl has asked for the
wisdom of the Perl Monks concerning the following question:
Need some help please on doing date/time arithmetic. Basically I have a script where I save the starttime and endtime using time(). And at the end of the run, I do a endtime - starttime to get the difference of how long the script took to run which I believe is in seconds.
Question is if there is any way of converting the result so that it can be displayed in x-days, x-hours, x-mins, x-seconds instead of second?
At the moment, am thinking of writing some sort of function to convert the seconds to hours, minute, seconds but before I go to that length, I am wishfully thinking that maybe someone had already come across the same requirement that am looking for. Any advise will be very much appreciated.
Excerpt of the Perl script as below. Note that am very restricted to what modules I have available and cannot install additional Date/Time modules that I've found very useful. At the moment, am only allowed Time::Local.
Any response or suggestions will be very much appreaciated. Thanks in advance.