The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.



Time::SoFar(3) User Contributed Perl Documentation Time::SoFar(3)


NNNNAAAAMMMMEEEE
       Time::SoFar - Perl module to calculate run time

SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
           use Time::SoFar qw( runtime runinterval figuretimes );

           # [...] denotes optional arguments
           $times = runtime( [$no_optimize] );
           @times = runtime( [$no_optimize] );

           $times = runinterval( [$no_optimize] );
           @times = runinterval( [$no_optimize] );

           $times = figuretimes( $seconds [, $no_optimize] );
           @times = figuretimes( $seconds [, $no_optimize] );


SSSSAAAAMMMMPPPPLLLLEEEESSSS
           my $elasped = runtime();
           print "Elapsed time $elapsed\n";
           # prints, eg, "Elapsed time 17:34\n"

           my $sincethen = runinterval(1);
           print "Time since then $sincethen\n";
           # prints, eg, "Time since then 0:00:00:51\n"

           ($day, $hour, $min, $sec) = figuretimes(86400 + 2*3600 + 3*60 + 4, 1);
           # $day = 1; $hour = 2; $min = 3; $sec = 4;

           @times = figuretimes(2*3600 + 3*60 + 4);
           # @times = (2, 3, 4)

           @times = figuretimes(17,1);
           # @times = (0, 0, 0, 17)

           $times = figuretimes(2*3600 + 3*60 + 4, 1);
           # $times = '0:02:03:04';


DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
       TTTTiiiimmmmeeee::::::::SSSSooooFFFFaaaarrrr has two functions for calculating how long a
       script has been running. `runtime()' always works from the
       time the script was started (using _$_^_T). `runinterval()'
       works from the last time `runtime()' or `runinterval()'
       was called (or since the start of the script).

       Both `runtime()' and `runinterval()' use `figuretimes()'
       to render a raw number of seconds into component time
       units. Both take an optional boolean argument that gets
       passed to `figuretimes()' to influence its output.

       In an array context `figuretimes()' returns the
       timecomponents as an array, in a scalar context it returns
       those components as a :::: delimited string. The default



2000-12-13                 perl v5.6.0                          1





Time::SoFar(3) User Contributed Perl Documentation Time::SoFar(3)


       behaviour is to optimize away 0 output from the longer
       period end of the output, leaving a minimum of
       minutes:seconds. This is good for arrays that will be
       passed to `join()', but not so good for a list of
       variables, so this behaviour can be disabled by using a
       true value for _$_n_o___o_p_t_i_m_i_z_e.

IIIINNNNHHHHEEEERRRRIIIITTTTAAAANNNNCCCCEEEE
       Time::SoFar inherits only from Exporter.

CCCCAAAAVVVVEEEEAAAATTTTSSSS
       Time::SoFar has a granularity of seconds, and is therefore
       not so useful for small elapsed times.

PPPPRRRREEEERRRREEEEQQQQUUUUIIIISSSSIIIITTTTEEEESSSS
       Only stock perl modules are used.

OOOOSSSSNNNNAAAAMMMMEEEESSSS
       So long as _$_^_T and `time()' are calculated using the same
       epoch there should be no operating system dependence.

SSSSEEEEEEEE AAAALLLLSSSSOOOO
       _$_^_T in the perlvar manpage.

CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT
       Copyright 2000 by Eli the Bearded / Benjamin Elijah
       Griffin.  Released under the same _l_i_c_e_n_s_e(s) as Perl.

AAAAUUUUTTTTHHHHOOOORRRR
       Eli the Bearded wrote this to do away with all the _$_^_T one
       liners at the end of his batch processing scripts.


























2000-12-13                 perl v5.6.0                          2