Package Info

perl-Time-Duration


Rounded or exact English expression of durations


Development/Libraries/Perl

This module provides functions for expressing durations in rounded or exact terms.

In the first example in the Synopsis, using duration($interval_seconds):

If the 'time() - $start_time' is 3 seconds, this prints "Runtime: 3 seconds.". If it's 0 seconds, it's "Runtime: 0 seconds.". If it's 1 second, it's "Runtime: 1 second.". If it's 125 seconds, you get "Runtime: 2 minutes and 5 seconds.". If it's 3820 seconds (which is exactly 1h, 3m, 40s), you get it rounded to fit within two expressed units: "Runtime: 1 hour and 4 minutes.". Using duration_exact instead would return "Runtime: 1 hour, 3 minutes, and 40 seconds".

In the second example in the Synopsis, using ago($interval_seconds):

If the $age is 3 seconds, this prints "file was modified 3 seconds ago". If it's 0 seconds, it's "file was modified just now", as a special case. If it's 1 second, it's "from 1 second ago". If it's 125 seconds, you get "file was modified 2 minutes and 5 seconds ago". If it's 3820 seconds (which is exactly 1h, 3m, 40s), you get it rounded to fit within two expressed units: "file was modified 1 hour and 4 minutes ago". Using ago_exact instead would return "file was modified 1 hour, 3 minutes, and 40 seconds ago". And if the file's modtime is, surprisingly, three seconds into the future, $age is -3, and you'll get the equally and appropriately surprising "file was modified 3 seconds from now."


License: Artistic-1.0 OR GPL-1.0-or-later
URL: https://metacpan.org/release/Time-Duration

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
1.210000-bp156.3.1 info GA Release 2023-07-22 15 SP6
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration
1.210000-bp155.2.12 info GA Release 2023-05-17 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration
1.210000-bp154.1.34 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration
1.200000-bp153.1.17 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration
1.200000-bp152.3.20 info GA Release 2020-04-16 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration
1.200000-bp151.3.1 info GA Release 2019-07-16 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration
1.200000-bp151.2.14 info GA Release 2019-05-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration
1.200000-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Time-Duration