<div dir="ltr">If you use DateTime instead of Class::Date, there's the DateTime::Duration class which will let you add durations:<div><br></div><div>my $duration = DateTime::Duration->new( seconds => 15 );</div><div>
$duration->add( seconds => 73 );</div><div>$duration->add( weeks => 12 );</div><div><br></div><div>There are some modules to help with formatting durations too. I think the nicest of which is this one:</div><div>
<br></div><div><a href="https://metacpan.org/pod/DateTime::Format::Human::Duration">https://metacpan.org/pod/DateTime::Format::Human::Duration</a></div><div><br></div><div>It's a pretty nice module.</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Mar 20, 2014 at 11:23 AM, Jay Hannah <span dir="ltr"><<a href="mailto:jay@jays.net" target="_blank">jay@jays.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mar 20, 2014, at 11:06 AM, Robert L. Harris <<a href="mailto:robert.l.harris@gmail.com">robert.l.harris@gmail.com</a>> wrote:<br>
> It looks like the reldate is what I want, not figure out how to use it.  No clear examples on "convert 561 seconds to 9 minutes, 21 seconds" :)<br>
<br>
Does this help?<br>
<br>
<a href="https://github.com/jhannah/sandbox/blob/master/robertlharris/go.pl" target="_blank">https://github.com/jhannah/sandbox/blob/master/robertlharris/go.pl</a><br>
<br>
<br>
$ cat <a href="http://go.pl" target="_blank">go.pl</a><br>
use Class::Date;<br>
use 5.10.0;<br>
<br>
my $reldate = new Class::Date::Rel "561s";<br>
say "In minutes: " . $reldate->min;<br>
say "In seconds: " . $reldate->sec;<br>
<br>
my $seconds_only = $reldate - (int($reldate->min) * 60 . 'm');  # subtract minutes away<br>
say "Seconds only: $seconds_only";<br>
printf("%d minutes %d seconds\n", int($reldate / 60), $seconds_only);<br>
<br>
<br>
$ perl <a href="http://go.pl" target="_blank">go.pl</a><br>
In minutes: 9.35<br>
In seconds: 561<br>
Seconds only: 21<br>
9 minutes 21 seconds<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
j<br>
<br>
<br>
_______________________________________________<br>
Omaha-pm mailing list<br>
<a href="mailto:Omaha-pm@pm.org">Omaha-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/omaha-pm" target="_blank">http://mail.pm.org/mailman/listinfo/omaha-pm</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Andrew Sterling Hanenkamp<br><a href="mailto:sterling@hanenkamp.com">sterling@hanenkamp.com</a><br>785.370.4454
</div>