1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-06 06:30:19 +00:00

devel/p5-Time-Duration-Parse-AsHash: Add p5-Time-Duration-Parse-AsHash 0.10.6

Time::Duration::Parse::AsHash is like Time::Duration::Parse except:
- By default it returns a hashref of parsed duration elements instead of number
  of seconds
  There are some circumstances when you want this, e.g. when feeding into
  DateTime::Duration and you want to count for leap seconds.
  To return number of seconds like Time::Duration::Parse, pass a true value as
  the second argument.
- By default seconds are not rounded
  For example: "0.1s" or 100ms will return result { seconds => 0.1 }, and "2.3s"
  will return { seconds => 2.3 }.
  Also, <01:02:03> being recognized as 1h2min3s, 01:02:03.4567 will also be
  recognized as 1h2min3.4567s.
- It recognizes more duration units
  milliseconds (ms), which will be returned in the seconds key, for example
  "400ms" returns { seconds => 0.4 }.
  microseconds. This will also be returned in seconds key.
  nanoseconds (ns). This will also be returned in seconds key.
  decades. This will be returned in years key, for example "1.5 decades" will
  return { years => 15 }.
- It has a lower startup overhead
  By avoiding modules like Carp and Exporter::Lite, even strict and warnings
  (starts up in ~3m vs ~9ms on my computer).
This commit is contained in:
Po-Chuan Hsieh 2024-09-05 13:13:51 +08:00
parent a38aa39e08
commit e83a453f6a
No known key found for this signature in database
GPG Key ID: 9A4BD10F002DD04B
5 changed files with 48 additions and 0 deletions

View File

@ -3812,6 +3812,7 @@
SUBDIR += p5-Time-Crontab
SUBDIR += p5-Time-Duration
SUBDIR += p5-Time-Duration-Parse
SUBDIR += p5-Time-Duration-Parse-AsHash
SUBDIR += p5-Time-Elapsed
SUBDIR += p5-Time-Format
SUBDIR += p5-Time-HiRes

View File

@ -0,0 +1,20 @@
PORTNAME= Time-Duration-Parse-AsHash
PORTVERSION= 0.10.6
CATEGORIES= devel perl5
MASTER_SITES= CPAN
PKGNAMEPREFIX= p5-
MAINTAINER= sunpoet@FreeBSD.org
COMMENT= Parse string that represents time duration
WWW= https://metacpan.org/dist/Time-Duration-Parse-AsHash
LICENSE= ART10 GPLv1+
LICENSE_COMB= dual
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= perl5
USE_PERL5= configure
NO_ARCH= yes
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1724084468
SHA256 (Time-Duration-Parse-AsHash-0.10.6.tar.gz) = b6776df009d00ef6bc74aa4e487523536b4578fec35dda9a88891b91d0d52831
SIZE (Time-Duration-Parse-AsHash-0.10.6.tar.gz) = 15754

View File

@ -0,0 +1,22 @@
Time::Duration::Parse::AsHash is like Time::Duration::Parse except:
- By default it returns a hashref of parsed duration elements instead of number
of seconds
There are some circumstances when you want this, e.g. when feeding into
DateTime::Duration and you want to count for leap seconds.
To return number of seconds like Time::Duration::Parse, pass a true value as
the second argument.
- By default seconds are not rounded
For example: "0.1s" or 100ms will return result { seconds => 0.1 }, and "2.3s"
will return { seconds => 2.3 }.
Also, <01:02:03> being recognized as 1h2min3s, 01:02:03.4567 will also be
recognized as 1h2min3.4567s.
- It recognizes more duration units
milliseconds (ms), which will be returned in the seconds key, for example
"400ms" returns { seconds => 0.4 }.
microseconds. This will also be returned in seconds key.
nanoseconds (ns). This will also be returned in seconds key.
decades. This will be returned in years key, for example "1.5 decades" will
return { years => 15 }.
- It has a lower startup overhead
By avoiding modules like Carp and Exporter::Lite, even strict and warnings
(starts up in ~3m vs ~9ms on my computer).

View File

@ -0,0 +1,2 @@
%%SITE_PERL%%/Time/Duration/Parse/AsHash.pm
%%PERL5_MAN3%%/Time::Duration::Parse::AsHash.3.gz