|Just another Perl shrine|
Time calculationsby Dirk80 (Monk)
|on Aug 20, 2010 at 15:57 UTC||Need Help??|
Dirk80 has asked for the wisdom of the Perl Monks concerning the following question:
I want to store times (hours, minutes, seconds, fractions of a second) in an object. Time::Piece and Time::Seconds make a good beginning. They offer some arithmetic operations and have overloaded >, <, ... .
The following code uses Time::Seconds and Time::Piece to construct the sum of "16:51" and "34:48" in the format (min:sec).
But there are two reasons why they are not sufficient for what I want to do.
Here the summary: I would like to have a parse function (time string e.g. "16:51,14" to time object). It should be possible to apply arithmetic operations and comparisons of time objects and the time object should at least store hours, minutes, seconds and fractions of a second. And of course I want to be able to print the time object (something like strftime).
Is there already a module in CPAN which can do this? I did not find any. What would you suggest how to solve that? I don't want to reinvent everything. If possible I want to use an available module.
I'm very interested in your answers.
Thank you and Greetings