sub clock_bugfix { my $minutes = shift; my $sign = ($minutes >= 0); my $hh = int($minutes/60); my $rest = abs($minutes - $hh*60); $hh *= -1 if($hh < 0); return sprintf ("%s%d:%02d", ($sign ? '' : '-'), $hh, $rest); }