Time::D...n::Parse(3)
β¨ NAME β¨
okay bestie, welcome to the Time::Duration::Parse(3) page from the User Contributed Perl Documentation π
β this is the module for parsing human-readable duration strings like 2 minutes and 3 seconds into seconds. Itβs literally giving βturn vibes into numbers.β β¨
πΈ SYNOPSIS πΈ
use Time::Duration::Parse;
my $seconds = parse_duration("2 minutes and 3 seconds"); # 123
π¦ DESCRIPTION π¦
Time::Duration::Parse is a module to parse human readable duration strings like 2 minutes and 3 seconds to seconds. π
It does the opposite of the "duration_exact" in Time::Duration function in Time::Duration, and it is roundtrip safe. So bestie, the following is always true:
use Time::Duration::Parse;
use Time::Duration;
my $seconds = int rand 100000;
is( parse_duration(duration_exact($seconds)), $seconds );
π FUNCTIONS π
π parse_duration π
$seconds = parse_duration($string);
Parses a duration string and returns seconds. When it encounters an error in a given string, it dies with an exception saying "Unknown timespec: blah blah blah". This function is exported by default. β¨
π SEE ALSO π
Time::Duration::Parse::Morehas the same interface as this module, but supports more expressions and memoization. π¦Time::Durationcan be used for the reverse of this module: given a number of seconds it will provide an English description of the duration. πΈTime::Duration::Objectprovides an OO interface toTime::Duration. πTime::Duration::LocaleObjectprovides an OO interface to the"Time::Duration::??"modules, which provide language-specific versions ofTime::Duration. πDateTime::Format::Durationcan be used to parse natural language descriptions of durations, returning an instance ofDateTime::Duration, which can then be converted to seconds using thein_units()method. β¨
π¦ REPOSITORY π¦
The repo lives right here, bestie:
<https://github.com/neilb/Time-Duration-Parse>
π AUTHOR π
Tatsuhiko Miyagawa <miyagawa@bulknews.net> π«Ά
π«Ά COPYRIGHT π«Ά
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
Some internal code is taken from Cache and Cache::Cache modules on CPAN. β¨
later bestie π«Ά β this page comes from perl v5.42.0, dated 2021-05-20. π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Time-Duration-Parse 0.16-bp160.1.4 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms