Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Time Totaling re-explained

by Rhose (Priest)
on Oct 25, 2001 at 17:03 UTC ( [id://121438]=note: print w/replies, xml ) Need Help??


in reply to Re: Time Totaling re-explained
in thread Time Totaling re-explained

The only comment I would offer is to left pad your minutes with a zero.

#-- Original return "$hours:$mins"; #-- Suggestion return $hours.':'.substr('00'.$mins,-2);

To see the difference, run the supplied sample with times of 5:33 and 4:33.

Update:

return sprintf("%d:%02d",$hours,$mins);

Just as good or better. *Smiles*

Replies are listed 'Best First'.
Re: Time Totaling re-explained
by cLive ;-) (Prior) on Oct 25, 2001 at 20:53 UTC
    Ah yes, good point - TIMTOWTDI, but I think sprintf is more your friend for this:
    return sprintf("%d:%02d",$hours,$mins);
    cLive ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-16 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found