* Bruno Negrão <[EMAIL PROTECTED]> [2004-07-13 23:53]:
> Hi Aristotle,
> 
> My module differs from DateTime::Duration because it is not
> dealing with dates. It does not try to foresee which is a
> future of past date based in a bunch of seconds.
> 
> It just provide a means to calculate a "time quantity" that is
> more human readable than a big number of seconds.

You mean, it deals with a... duration?

> To do this with my module you would:
> 
> #  - converting seconds to hours -
> new $time = new Time::Seconds::GroupedBy('HOURS');
> my ($secs, $mins, $hours) = $time->calculate(7341);
> print "$hours hours $mins minutes $secs seconds\n";

Ah, so you reinvented DateTime::Format::Duration.

    use DateTime::Format::Duration;
    my $fmt = DateTime::Format::Duration->new(
        pattern => '%H hours, %M minutes, %S seconds',
        normalize => 1,
    );
    print $fmt->format_duration_from_deltas(
        seconds => 7341,
    ), "\n";

> Well, it's usefull for me. I didn't find yet a module providing
> this kind of conversion...

I haven't done this before either. It took me about 10 minutes of
research on CPAN. Maybe my advantage was that I knew about the
DateTime project which set out to solve the issue of using Perl
for date and time math Once And For All.

Regards,
-- 
Aristotle
"If you can't laugh at yourself, you don't take life seriously enough."

Reply via email to