Time::Elapsed - Displays the elapsed time as a human readable string.


Time-Elapsed documentation  | view source Contained in the Time-Elapsed distribution.

Index


NAME

Top

Time::Elapsed - Displays the elapsed time as a human readable string.

SYNOPSIS

Top

   use Time::Elapsed qw( elapsed );
   $t = 1868401;
   print elapsed( $t );

prints:

   21 days, 15 hours and 1 second

If you set the language to turkish:

   print elapsed( $t, 'TR' );

prints:

   21 gün, 15 saat ve 1 saniye

DESCRIPTION

Top

This module transforms the elapsed seconds into a human readable string. It can be used for (for example) rendering uptime values into a human readable form. The resulting string will be an approximation. See the CAVEATS section for more information.

IMPORT PARAMETERS

Top

This module does not export anything by default. You have to specify import parameters. :all key does not include import commands.

FUNCTIONS

   elapsed

KEYS

   :all

COMMANDS

   Parameter   Description
   ---------   -----------
   -compile    All available language data will immediately be compiled
               and placed into an internal cache.

FUNCTIONS

Top

elapsed SECONDS [, OPTIONS ]

OPTIONS

lang

The optional argument language id, represents the language to use when converting the data to a string. The language section is really a standalone module in the Time::Elapsed::Lang:: namespace, so it is possible to extend the language support on your own. Currently supported languages are:

   Parameter  Description
   ---------  -----------------
      EN      English (default)
      TR      Turkish
      DE      German

Language ids are case-insensitive. These are all same: en, EN, eN.

weeks

If this option is present and set to a treu value, then you'll get "weeks" instead of "days" in the output if the output has a days value between 7 days and 28 days.

CAVEATS

Top

SEE ALSO

Top

PTools::Time::Elapsed, DateTime, DateTime::Format::Duration, Time::Duration.


Time-Elapsed documentation  | view source Contained in the Time-Elapsed distribution.