Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: time calculation

by rhesa (Vicar)
on Feb 03, 2006 at 19:48 UTC ( [id://527796]=note: print w/replies, xml ) Need Help??


in reply to time calculation

What have you tried sofar?

Converting to seconds seems like a sensible approach. You could do it like this:

use List::Util qw/ sum /; # calculate total number of seconds $seconds = sum map { my ($m,$s) = split /:/; $m*60 + $s } qw/ 01:45 60:00 45:25 /; # or your array with times $minutes = int($seconds / 60); # integral number of minutes $seconds = $seconds % 60; # remaining seconds $new_time = sprintf "%02d:%02d", $minutes, $seconds;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-24 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found