in reply to Re: time session problem
in thread time session problem

i tried your code! thanx for the solution... i tried it and got an answer like elapsed=80640... how do i convert it again to a format of hr:min:sec? thanx! thanx a lot man!

Replies are listed 'Best First'.
Re: Re: Re: time session problem
by davorg (Chancellor) on Nov 24, 2000 at 14:05 UTC

    I already did something like that here

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

Re: Re: Re: time session problem
by mdillon (Priest) on Nov 24, 2000 at 08:21 UTC
    sub time_format { my $time = shift; my @parts; if ($time >= 3600) { my $hours = int($time / 3600); $time -= $hours * 3600; push @parts, $hours; } if ($time >= 60) { my $minutes = int($time / 60); $time -= $minutes * 60; push @parts, $minutes; } else { push @parts, 0 if @parts; } push @parts, $time; return sprintf join(':', ('%02d') x @parts), @parts; }