[mythtv-users] Help with pdatranscode.pl
Joe Ripley
vitaminjoe at gmail.com
Thu Aug 23 17:16:54 UTC 2007
On 8/22/07, Jon Larson <jtlarson at u.washington.edu> wrote:
> I'd like to end up with a duration in HH:mm:ss that I can add to the
> podcast XML--can anyone provide advice on how to do this?
This script does a fairly good job:
#!/usr/bin/perl -w
use POSIX;
srand(time);
for (my $i=0; $i<10; $i++) {
my $interval = int(rand(10000));
my $hour = sprintf("%02d", POSIX::floor($interval / 3600));
my $min = sprintf("%02d", POSIX::floor($interval - ($hour * 3600)) / 60);
my $sec = sprintf("%02d", $interval - ($min * 60) - ($hour * 3600));
print "($interval seconds) = HH:MM:SS = $hour:$min:$sec\n";
}
--
Joe Ripley
vitaminjoe at gmail.com
More information about the mythtv-users
mailing list