Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my Int $sec-in-hour = 3600;
- my Int $sec-in-min = 60;
- sub MAIN (Int $seconds)
- {
- say hms($seconds);
- }
- sub hms (Int $seconds is rw)
- {
- my (Int $hours, Int $minutes);
- $hours = $seconds div $sec-in-hour;
- $seconds %= $sec-in-hour if $hours > 0;
- $minutes = $seconds div $sec-in-min;
- $seconds %= $sec-in-min if $minutes > 0;
- return "$hours hours, $minutes minutes, $seconds seconds";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement