Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- $a=scalar(@ARGV);
- for ($i=0;$i<4;$i++) {$t[$i]=0;}
- for ($i=0;$i<$a;$i++) {
- $t[$a-1-$i]=$ARGV[$i];
- }
- $t=$t[0]+$t[1]*60+$t[2]*3600+$t[3]*6*3600;
- if ($a==1) {
- $s=$t%60; $t/=60;
- $m=$t%60; $t/=60;
- $h=$t%6; $t/=6;
- $d=$t;
- printf "%dd %d:%d:%d\n",$d,$h,$m,$s;
- } else {
- printf "%d\n",$t;
- }
- #bernhard@b:~/src$ ./kspconverttime 1 1 0 0
- #25200
- #bernhard@b:~/src$ ./kspconverttime 25200
- #1d 1:0:0
- #echo `./kspconverttime 10 43 17`-`./kspconverttime 3 40 0`|bc|./kspconverttime `cat /proc/self/fd/0`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement