-
-
Save anonymous/7ba40a37a8d8f7b6f1fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub seconds_to_duration { | |
my $sec = shift; | |
$days = $sec/(24*60*60); | |
$hours = ($sec/(60*60))%24; | |
$min = ($sec/60)%60; | |
$sec = $sec%60; | |
$duration_str = sprintf("%02d", $hours) . ":" . sprintf("%02d", $min) . ":" . sprintf("%02d", $sec) ; | |
return $duration_str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment