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


Manual Reference Pages  -  TIME::DURATION::PARSE (3)

.ds Aq ’

NAME

Time::Duration::Parse - Parse string that represents time duration

CONTENTS

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 duration_exact function in Time::Duration and is roundtrip safe. So, 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 duration string and returns seconds. When it encounters an error in a given string, it dies an exception saying Unknown timespec: blah blah blah. This function is exported by default.

SEE ALSO

Time::Duration::Parse::More has the same interface as this module, but supports more expressions and memoization.

Time::Duration can be used for the reverse of this module: given a number of seconds it will provide an English description of the duration.

Time::Duration::Object provides an OO interface to Time::Duration.

Time::Duration::LocaleObject provides an OO interface to the Time::Duration::?? modules, which provide language-specific versions of Time::Duration.

DateTime::Format::Duration can be used to parse natural language descriptions of durations, returning an instance of DateTime::Duration, which can then be converted to seconds using the in_units() method.

REPOSITORY

<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.

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


perl v5.20.3 TIME::DURATION::PARSE (3) 2015-10-25

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