Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: solving modulo trouble

by aaron_baugher (Curate)
on Jun 20, 2015 at 21:57 UTC ( #1131299=note: print w/replies, xml ) Need Help??


in reply to solving modulo trouble

In math terms, when you do a division problem, dividing gives you the quotient and taking the modulo gives you the remainder. Here, dividing a number of seconds by 3600 and dropping the decimal gives you the hours. Taking the modulo gives you the remainder of seconds:

my $s = 7209; # 2 hours and 9 seconds my $hours = int $s/3600; my $seconds = $s % 3600;

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2020-06-02 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (13 votes). Check out past polls.

    Notices?