|
NAMETime::Duration::Parse::AsHash - Parse string that represents time duration VERSIONversion 0.10.6 SYNOPSIS use Time::Duration::Parse::AsHash;
my $res = parse_duration("2 minutes and 3 seconds"); # => {minutes=>2, seconds=>3}
$res = parse_duration("2m3.2s", 1); # => 123.2
$res = parse_duration("01:02:03", 1); # => 3723
DESCRIPTIONTime::Duration::Parse::AsHash is like Time::Duration::Parse except:
FUNCTIONSparse_duration($str [, $as_secs ]) => hashParses duration string and returns hash (unless when the second argument is true, in which case will return the number of seconds). Dies on parse failure. Currently two forms of string are recognized: the first is a series of number and time units (e.g. "2 days, 3 hours, 4.5 minutes" or "2h3m4s") and the second is time in the format of hh:mm:ss (the seconds can contain decimal numbers) or hh:mm. This function is exported by default. Note that if the function is instructed to return number of seconds, the result is an approximation: leap seconds are not regarded (so a minute is always 60 seconds), a month is always 30 days, a year is always 365 days. SEE ALSOTime::Duration::Parse AUTHORperlancar <perlancar@cpan.org> COPYRIGHT AND LICENSEThis software is copyright (c) 2017 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|