I am not sure about a standard, but this idea may work:
#!/usr/bin/perl
use strict;
print "${\SecondsToTime(22)}\n";
print "${\SecondsToTime(220)}\n";
print "${\SecondsToTime(2200)}\n";
print "${\SecondsToTime(22000)}\n";
exit;
sub SecondsToTime {
# Takes a number of seconds, and creates a string in the 'dd hh:mm
+:ss' format.
my ( $time ) = shift;
$time = int( $time );
my $newTime = sprintf( "%.2d ", int($time / 86400) );
$newTime .= sprintf( "%.2d", int(($time % 86400) / 3600) );
$newTime .= ':' . sprintf( "%.2d", int(($time % 3600) / 60) );
$newTime .= ':' . sprintf( "%.2d", int(($time % 3600) % 60) );
return ( $newTime );
}
Chris