Created
July 12, 2017 12:41
-
-
Save axtstar/b5b480ba2a6d32418897a3b03abedb52 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
use strict; | |
use warnings; | |
use POSIX; | |
my $numStr = ""; | |
my $length = @ARGV; | |
if ($length>0){ | |
$numStr = $ARGV[0]; | |
} | |
else { | |
$numStr = <STDIN>; | |
} | |
my $hh=0; | |
my $mm=0; | |
my $ss=0; | |
$hh = floor("$numStr" / 3600); | |
$mm = floor(("$numStr" - "$hh" * 3600) / 60); | |
$ss = "$numStr" - "$hh" * 3600 - "$mm" * 60; | |
printf ("%02d:%02d:%02d",$hh,$mm,$ss); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment