GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Time::Elapsed(3) User Contributed Perl Documentation Time::Elapsed(3)

Time::Elapsed

version 0.33

   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

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.

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

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

   elapsed

   :all

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

  • "SECONDS" must be a number representing the elapsed seconds. If it is false, 0 (zero) will be used. If it is not defined, "undef" will be returned.
  • The optional argument "OPTIONS" is a either a string containing the language id or a hashref containing several options. These two codes are equal:

       elapsed $secs, 'DE';
       elapsed $secs, { lang => 'DE' };
        

    The hashref is used to pass extra 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.

  • The calculation of the elapsed time is only an approximation, since these values are used internally:

       1 Day   =  24 Hour
       1 Month =  30 Day
       1 Year  = 365 Day
        

    See "How Datetime Math is Done" in DateTime for more information on this subject. Also see "in_units()" method in DateTime::Duration.

  • This module' s source file is UTF-8 encoded (without a BOM) and it returns UTF-8 values whenever possible.
  • Currently, the module won't work with any perls older than 5.6 because of the UTF-8 encoding and the usage of utf8 pragma. However, the pragma limitation can be by-passed with a %INC trick under 5.005_04 (tested) and can be used with english language (default behavior), but any other language will probably need unicode support.

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

Burak Gursoy <burak@cpan.org>

This software is copyright (c) 2007 by Burak Gursoy.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2018-12-25 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.