Commit 72cd45da authored by gregor herrmann's avatar gregor herrmann

Imported Upstream version 1.12

parent 7d2c5c06
......@@ -10,19 +10,29 @@ if ($@)
my $builder = Module::Build->new(
module_name => 'Time::Format',
license => 'unrestricted',
dist_author => 'Eric J. Roode <roode@cpan.org>',
dist_version_from => 'lib/Time/Format.pm',
build_requires => {
'Test::Simple' => '0.40',
},
requires =>
{
'Time::Local' => '1.07',
},
sign => 1,
add_to_cleanup => [ 'Time-Format-*' ],
module_name => 'Time::Format',
license => 'unrestricted',
dist_author => 'Eric J. Roode <roode@cpan.org>',
dist_version_from => 'lib/Time/Format.pm',
configure_requires => {
'Module::Build' => '0.4',
},
build_requires => {
'Test::Simple' => '0.40',
},
requires => {
'Time::Local' => '1.07',
},
recommends => {
'I18N::Langinfo' => 0,
'POSIX' => 0,
'Time::HiRes' => 0,
'DateTime' => 0,
'Date::Manip' => 0,
'Module::Signature' => 0,
},
sign => 1,
add_to_cleanup => [ 'Time-Format-*' ],
);
$builder->create_build_script();
......@@ -112,6 +112,23 @@
code) if the argument was a DateTime. Thanks to Coke Coleda
for spotting this.
1.10 2009 June 18
1.11 2009 June 18
- Fix error in the new test (past.t) for v1.10!
- Rearrange eval's throughout test code to rely on $@ less.
1.12 2012 September 27
- Fix CPAN RT bug 44167/54990: Negative milliseconds/microseconds.
This was a boneheaded mistake I should have fixed years ago.
Many thanks to Karl Moens for reporting the error, and for a patch.
- Fix CPAN RT bug 47229: Build.PL dependencies.
Unfortunately, I cannot fix Makefile.PL, since ExtUtils::MakeMaker
has no concept of "recommended" or "optional" modules.
Thanks to Jens Rehsack for the suggestion.
- Fix CPAN RT bug 55630: ISO-8601 Z (Zulu, UTC) marker not supported.
Thanks to Will Coleda for pointing this out.
- Fix CPAN RT bug 76705/76707 (maybe): month out of range.
I can't reproduce this bug, but I made a change to the time parsing
that might fix it. Thanks to Todd Bezenek for reporting the problem.
......@@ -2,6 +2,7 @@ Build.PL
Changes
MANIFEST
MANIFEST.SKIP
META.json
META.yml
Makefile.PL
README
......@@ -22,6 +23,7 @@ t/export3.t
t/funcs.t
t/locale.t
t/manip.t
t/msec.t
t/past.t
t/quot.t
t/strftime.t
......@@ -33,3 +35,4 @@ t/xs_funcs.t
t/xs_locale.t
t/xs_quot.t
t/xs_time.t
SIGNATURE Added here by Module::Build
^Makefile$
^Makefile.old$
^blib/
^pm_to_blib
^blibdirs
^Build$
^Build.bat$
^_build/
^Time-Format-[\d.]+/
^Time-Format\.ppd
\bCVS\b
~$
\.tar\.gz$
^pod.*tmp$
^\.cvsignore$
^cover_db
^Makefile$
^Makefile.old$
^blib/
^pm_to_blib
^blibdirs
^Build$
^Build.bat$
^_build/
^Time-Format-[\d.]+/
^Time-Format\.ppd
\bCVS\b
^.git
project-readme
~$
\.tar\.gz$
^pod.*tmp$
^\.cvsignore$
^cover_db
^MYMETA
{
"abstract" : "Easy-to-use date/time formatting.",
"author" : [
"Eric J. Roode <roode@cpan.org>"
],
"dynamic_config" : 1,
"generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.110440",
"license" : [
"unrestricted"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Time-Format",
"prereqs" : {
"build" : {
"requires" : {
"Test::Simple" : "0.40"
}
},
"configure" : {
"requires" : {
"Module::Build" : "0.4"
}
},
"runtime" : {
"recommends" : {
"Date::Manip" : 0,
"DateTime" : 0,
"I18N::Langinfo" : 0,
"Module::Signature" : 0,
"POSIX" : 0,
"Time::HiRes" : 0
},
"requires" : {
"Time::Local" : "1.07"
}
}
},
"provides" : {
"Time::Format" : {
"file" : "lib/Time/Format.pm",
"version" : "1.12"
}
},
"release_status" : "stable",
"version" : "1.12"
}
--- #YAML:1.0
name: Time-Format
version: 1.11
abstract: Easy-to-use date/time formatting.
license: ~
author:
- Eric Roode <roode@cpan.org>
generated_by: ExtUtils::MakeMaker version 6.44
distribution_type: module
requires:
Test::Simple: 0.40
Time::Local: 1.07
---
abstract: 'Easy-to-use date/time formatting.'
author:
- 'Eric J. Roode <roode@cpan.org>'
build_requires:
Test::Simple: 0.40
configure_requires:
Module::Build: 0.4
dynamic_config: 1
generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.110440'
license: unrestricted
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
version: 1.3
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Time-Format
provides:
Time::Format:
file: lib/Time/Format.pm
version: 1.12
recommends:
Date::Manip: 0
DateTime: 0
I18N::Langinfo: 0
Module::Signature: 0
POSIX: 0
Time::HiRes: 0
requires:
Time::Local: 1.07
version: 1.12
File mode changed from 100644 to 100755
Time::Format version 1.11
Time::Format version 1.12
=========================
Time::Format provides a very easy way to format dates and times. The
......@@ -65,8 +65,8 @@ If you do not have Module::Build, use the old-style commands:
make test
make install
If you are running under Windows, you will need to use 'nmake' instead
of 'make'.
If you're using Strawberry Perl, you may need to use 'dmake' instead of
'make. If you're using ActiveState Perl, you may need to use 'nmake'.
DEPENDENCIES
......@@ -87,7 +87,7 @@ COPYRIGHT AND LICENSE
Eric J. Roode, roode @ cpan . org
Copyright (c) 2003-2009 by Eric J. Roode. All Rights Reserved.
Copyright © 2003-2012 by Eric J. Roode. All Rights Reserved.
This module is free software; See the copyright notice in the
module source code for full details.
......
This file contains message digests of all files listed in MANIFEST,
signed via the Module::Signature module, version 0.55.
signed via the Module::Signature module, version 0.68.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
......@@ -14,44 +14,46 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
SHA1 788642c04d87fd08ab37c47becafaa017e8ae45a Build.PL
SHA1 18ea5e04f2672abf000988c24975f8b263749ea1 Changes
SHA1 5778d42ec82cb9ff5b3e711008c16a06ff340d11 MANIFEST
SHA1 aa9b2f3cbd5f90ccb7260734593e4de1a7972b90 MANIFEST.SKIP
SHA1 1360b3a426806f179e895b45be824cd6829455bf META.yml
SHA1 9c459381eef73dade1e6d38530846b50f0901731 Makefile.PL
SHA1 483535639f76e3e1e417e1d0edf0996590569ef7 README
SHA1 8239155b1a7328890c7a5e41dfc8ae074f87d6e6 lib/Time/Format.pm
SHA1 829b98264e37c56117646eed075e039f03ae6892 quickref.ps
SHA1 2d3df18b888ce54592232c9fa4fe59480340c212 quickref.txt
SHA1 85bda61499a37e0128b67166d7b0ace7e631676e t/0-signature.t
SHA1 6485dd41e255a38c57986fe86dca56a1ca6dac97 t/1-load.t
SHA1 bae14ef08a158a5b46b37f8c1daf836547f2cc4e t/DateManip.t
SHA1 80cda162244702a8091706abd2f94dffda9a0b55 t/DateTime.t
SHA1 e54c03886f4466bbe803cfbea88226a430f4511d t/die.t
SHA1 5f54aa49bfbaa71d52468d42468afce1c0acc585 t/doc.t
SHA1 e1a6f2be6db2551661299ff12bb32fd0fade73e6 t/epoch.t
SHA1 56c91f05df9f93155b918a98f004b3239c57ac57 t/export1.t
SHA1 96054241cdd6d43799569b5dd7efb7ada9964fc2 t/export2.t
SHA1 c3792783e7a73a9ae93d6f8f9575421b32ef47d9 t/export3.t
SHA1 6bd4e629990832908abfea314a1733e3e150153c t/funcs.t
SHA1 0e31be1cf28677e8189cade1a903071760fd3df4 t/locale.t
SHA1 29783572625af2246d980bd7a16fb1efd6fd27c5 t/manip.t
SHA1 0ae99d8d225c57d306b3a6198bb0a5be64e72d47 t/past.t
SHA1 509cabd441d7e47117ee46be9c5832be55caa720 t/quot.t
SHA1 26fe4e61a13d2d6e19a3812ba7c8013175aa4338 t/strftime.t
SHA1 8c8d6e4b4978505924f137c4dd492055ff18b630 t/string.t
SHA1 fb636b39acc23e773db7406d3f1b84b6059240fa t/time.t
SHA1 c9d0b6166805d4477e3387ccb2cd0bfa6056246a t/xs_DateTime.t
SHA1 3448367c017f771673bf30f4603fb11400a888f4 t/xs_doc.t
SHA1 bde375233e922e7fd7fc6bc203128cef6f96fd01 t/xs_funcs.t
SHA1 f03d06a73b1b6dbb6ea8c9171e776e06c4111a34 t/xs_locale.t
SHA1 0aa9f17e9e3a283a7f1aa26587091a3f0c6248b3 t/xs_quot.t
SHA1 1d67a33bfbd58d3f17bb6d63f5838bd47b8a90f8 t/xs_time.t
SHA1 1c33e505a1fdc3cfef8ddc7d81ac8fcbedb2ffc4 Build.PL
SHA1 0bcff6142a9d23a5ea58b5808fb126d4e41d6b98 Changes
SHA1 66a822afb4118d16bd197c56890c0a0fdafea279 MANIFEST
SHA1 25d3591e9e70e063060b3f6e84a02cddcdb7eea3 MANIFEST.SKIP
SHA1 3faa4b01cdb679c70c4df759874f4dd195df8519 META.json
SHA1 b7bf9a7988c6484d7a709bad2f2fbd3463a1b601 META.yml
SHA1 4107e58592be9097ee50c35ea1a7e18c889babc6 Makefile.PL
SHA1 89cc6e74ff86bd9d4fa010371dffa4a5f57560ba README
SHA1 83e01a3755005b465f7d564afa3831e3cebf61fa lib/Time/Format.pm
SHA1 08ad6964b640216384e46ee9e45420eb0ce12c8a quickref.ps
SHA1 85df119635f3dc1e7f8c9302e792b33acee6234b quickref.txt
SHA1 99cee9783f69832def35f701bc0d05765b5fc1fe t/0-signature.t
SHA1 378bca05e6f687e166324362dbc5fc2bd388cff6 t/1-load.t
SHA1 4b17f7526967622a8324d0d8f795359c3666585b t/DateManip.t
SHA1 d9b73771fc15f9db41fefb115bacabe3144ea68e t/DateTime.t
SHA1 6d78667d977e7253caae73d56178b7a55ea136e5 t/die.t
SHA1 66ea641bbff7dc662daecc75b1ffc725bfd57398 t/doc.t
SHA1 8d38329acb598e97f061b6554875ea14ff02f198 t/epoch.t
SHA1 eee0fee8baf431dc92c910bd38a4a297adffa4a7 t/export1.t
SHA1 15bc5b6ec86d9e93fa3e3336700b9187901c1094 t/export2.t
SHA1 d1d784e475e3d7db3f6b4894b9818ae45120e3cf t/export3.t
SHA1 f97c1e438fc0daa90c52bb6fc8267aa9e96988ab t/funcs.t
SHA1 05c8288c60f2fd9aac278d7c9163e707dfeebc60 t/locale.t
SHA1 79c11cd2571ca5337f1f059535e1dff48bc66422 t/manip.t
SHA1 2dc22201d40eb78535ab8a8b8fa728cf737f6317 t/msec.t
SHA1 e0dcdd23629e9dfbe2cf60e2c39b0494f73deca2 t/past.t
SHA1 7faf52862fde8c3308622fbdc48ee5a87074293e t/quot.t
SHA1 4135d6ee0b23d752acb6a49d7d5ee30d01c4b075 t/strftime.t
SHA1 eac4650d27a5131a2f84955dfd84b0dc034cbfc5 t/string.t
SHA1 12f8d6a5280357c0e1f2e3f0248b97290af8b597 t/time.t
SHA1 9eee35fdaf448b3c5c57c39bdd4d0ef6f8b2f050 t/xs_DateTime.t
SHA1 055b4850da6aa9852ee118c685b6afe145577ebb t/xs_doc.t
SHA1 fbc8bbd78d68093de981122148369b40ff0153a2 t/xs_funcs.t
SHA1 9021f1c6f1019891b61194f9edde60497d09a80f t/xs_locale.t
SHA1 140cb309ff3c2477d30d7de83031d5585faa68f6 t/xs_quot.t
SHA1 a02341928da64587b5dc2aef1ca0528dba6c0c3c t/xs_time.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Version: GnuPG v1.4.12 (Cygwin)
iEYEARECAAYFAko6/H8ACgkQwoSYc5qQVqpE+ACfQSfNHu0aaCUPQOqlioqdyh+m
IUIAn3axpp32TWUHzoc9WW9qKO/wLfiv
=TcEi
iEYEARECAAYFAlBkf6cACgkQwoSYc5qQVqqrmACeMTmVnr5SnhVRTqIJ4xgxIUE7
2WIAnAmjG3ZX9XjHWDlRDzMx6vZo6peG
=fJN/
-----END PGP SIGNATURE-----
......@@ -2,19 +2,21 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
=encoding utf8
=head1 NAME
Time::Format - Easy-to-use date/time formatting.
=head1 VERSION
This documentation describes version 1.11 of Time::Format.pm, June 18, 2009.
This is version 1.12 of Time::Format, September 27, 2012.
=cut
use strict;
package Time::Format;
$Time::Format::VERSION = '1.11';
$Time::Format::VERSION = '1.12';
# This module claims to be compatible with the following versions
# of Time::Format_XS.
......@@ -338,21 +340,26 @@ sub _classify_time
# Except we make it more flexible by allowing the date OR the time to be specfied
# This will also match Date::Manip strings, and many ISO-8601 strings.
elsif ($timeval =~ m{\A( (?!\d{6,8}\z) # string must not consist of only 6 or 8 digits.
(?:
\d{4} [-/.]? \d{2} [-/.]? \d{2} # year-month-day
(?: # year-month-day
\d{4} # year
[-/.]? (?:0[1-9]|1[0-2]) # month
[-/.]? (?:0[1-9]|[12]\d|3[01]) # day
)? # ymd is optional
(?: (?<=\d) [T_ ] (?=\d) )? # separator: T or _ or space, but only if ymd and hms both present
) # End of $1: YMD and separator
(?: # hms is optional
(
\d{2} [:.]? \d{2} [:.]? \d{2} # hour:minute:second
(?:[01]\d|2[0-4]) # hour
[:.]? (?:[0-5]\d) # minute
[:.]? (?:[0-5]\d|6[0-1])? # second
) # End of $2: HMS
(?: [,.] (\d+))? # optional fraction
(Z?) # optional "zulu" (UTC) designator
)? # end of optional (HMS.fraction)
\z
}x)
{
$cache_value = ($1 || q{}) . ($2 || q{});
$cache_value = ($1 || q{}) . ($2 || q{}) . ($4 || q{});
$frac = $3? '0.' . $3 : 0;
$time_type = $DATETIME_STRING;
}
......@@ -370,7 +377,7 @@ sub _classify_time
# Get numeric time
$timeval = _have('Time::HiRes')? Time::HiRes::time() : time;
$cache_value = int $timeval;
$frac = $cache_value - $timeval;
$frac = $timeval - $cache_value;
$time_type = $NUMERIC_TIME;
}
else
......@@ -452,7 +459,7 @@ sub decode_DateTime_object
$dt->second, $dt->minute, $dt->hour,
$dt->day, $dt->month, $dt->year,
$dt->dow, $dt->doy, $dt->is_dst);
$t[-1] = 0 if $t[-1] == 7; # Convert 1-7 (Mon-Sun) to 0-6 (Sun-Sat).
$t[-3] = 0 if $t[-3] == 7; # Convert 1-7 (Mon-Sun) to 0-6 (Sun-Sat).
return @t;
}
......@@ -469,6 +476,7 @@ sub decode_DateTime_string
(?: # hms is optional
(\d{2}) [:.]? (\d{2}) [:.]? (\d{2}) # hour:minute:second
(?: [,.] \d+)? # optional fraction (ignored in this sub)
(Z?) # optional "zulu" (UTC) indicator
)? \z
}x)
{
......@@ -477,9 +485,9 @@ sub decode_DateTime_string
die qq{Unrecognized DateTime string "$dts": probable Time::Format bug};
}
my ($y,$mon,$d,$h,$min,$s) = ($1,$2,$3,$4,$5,$6);
my ($y,$mon,$d,$h,$min,$s,$tz) = ($1,$2,$3,$4,$5,$6,$7);
my ($d_only, $t_only);
my ($h12, $tz, $is_dst, $dow);
my ($h12, $is_dst, $dow);
if (!defined $y)
{
# Time only. Set date to 1969-12-31.
......@@ -520,8 +528,14 @@ sub decode_DateTime_string
my @t = map {$_+0} ($s,$min,$h,$d,$mon,$y);
$h12 += 0;
$tz = POSIX::strftime('%Z', @t, $dow, -1, $is_dst)
if _have('POSIX');
if ($tz && $tz eq 'Z')
{
$tz = 'UTC';
}
elsif (_have('POSIX'))
{
$tz = POSIX::strftime('%Z', @t, $dow, -1, $is_dst);
}
return ($h12, $tz, @t, $dow, -1, $is_dst);
}
......@@ -1127,7 +1141,7 @@ limitation.
=head1 AUTHOR / COPYRIGHT
Copyright (c) 2003-2009 by Eric J. Roode, ROODE I<-at-> cpan I<-dot-> org
Copyright © 2003-2012 by Eric J. Roode, ROODE I<-at-> cpan I<-dot-> org
All rights reserved.
......@@ -1155,11 +1169,11 @@ endeavor to improve the software.
=begin gpg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Version: GnuPG v1.4.12 (Cygwin)
iEYEARECAAYFAko6+8sACgkQwoSYc5qQVqpHSgCggtDbvzExQFNs4b1QoF/t9TaU
BNYAn0C5LsPiJqCk4lzf8Jfn/4t+Zw7+
=C+Tp
iEYEARECAAYFAlBkW30ACgkQwoSYc5qQVqqrEQCfbTBXPht5+eHBMYZwO+nfbbWM
1BsAniYB6BwNCwmTOyawYbV7qQFGBbYt
=/RZp
-----END PGP SIGNATURE-----
=end gpg
This diff is collapsed.
Quick reference for Time::Format formatting codes.
$time{$format}
$time{$format, $time_value}
Numbers:
yyyy 4-digit year
yy 2-digit year, 00-99
m 1- or 2-digit month, 1-12
mm 2-digit month, 01-12
?m month with leading space if < 10
m{on} Unambiguous month, 1-12
mm(on} Unambiguous month, 01-12
?m(on} Unambiguous month with leading space if < 10
d day number, 1-31
dd day number, 01-31
?d day with leading space if < 10
h hour, 0-23
hh hour, 00-23
?h hour, 0-23 with leading space if < 10
H hour, 1-12
HH hour, 01-12
?H hour, 1-12 with leading space if < 10
m minute, 0-59
mm minute, 00-59
?m minute, 0-59 with leading space if < 10
m{in} Unambiguous minute, 1-12
mm(in} Unambiguous minute, 01-12
?m(in} Unambiguous minute with leading space if < 10
s second, 0-59
ss second, 00-59
?s second, 0-59 with leading space if < 10
mmm millisecond, 000-999
uuuuuu microsecond, 000000-999999
Names and other strings:
Month full month name, mixed-case (locale-specific capitalization)
MONTH full month name, all-uppercase
month full month name, all-lowercase
Mon 3-letter month abbreviation
MON ditto, all-uppercase
mon ditto, all-lowercase
Weekday weekday name
WEEKDAY weekday name, all-uppercase
weekday weekday name, all-lowercase
Day 3-letter weekday name abbreviation
DAY ditto, all-uppercase
day ditto, all-lowercase
th day suffix (st, nd, rd, or th)
TH uppercase suffix
am The string "am" or "pm"
pm ditto
AM The string "AM" or "PM"
PM ditto
a.m. The string "a.m." or "p.m."
p.m. ditto
A.M. The string "A.M." or "P.M."
P.M. ditto
tz time zone abbreviation
Quick reference for Time::Format formatting codes.
$time{$format}
$time{$format, $time_value}
Numbers:
yyyy 4-digit year
yy 2-digit year, 00-99
m 1- or 2-digit month, 1-12
mm 2-digit month, 01-12
?m month with leading space if < 10
m{on} Unambiguous month, 1-12
mm(on} Unambiguous month, 01-12
?m(on} Unambiguous month with leading space if < 10
d day number, 1-31
dd day number, 01-31
?d day with leading space if < 10
h hour, 0-23
hh hour, 00-23
?h hour, 0-23 with leading space if < 10
H hour, 1-12
HH hour, 01-12
?H hour, 1-12 with leading space if < 10
m minute, 0-59
mm minute, 00-59
?m minute, 0-59 with leading space if < 10
m{in} Unambiguous minute, 1-12
mm(in} Unambiguous minute, 01-12
?m(in} Unambiguous minute with leading space if < 10
s second, 0-59
ss second, 00-59
?s second, 0-59 with leading space if < 10
mmm millisecond, 000-999
uuuuuu microsecond, 000000-999999
Names and other strings:
Month full month name, mixed-case (locale-specific capitalization)
MONTH full month name, all-uppercase
month full month name, all-lowercase
Mon 3-letter month abbreviation
MON ditto, all-uppercase
mon ditto, all-lowercase
Weekday weekday name
WEEKDAY weekday name, all-uppercase
weekday weekday name, all-lowercase
Day 3-letter weekday name abbreviation
DAY ditto, all-uppercase
day ditto, all-lowercase
th day suffix (st, nd, rd, or th)
TH uppercase suffix
am The string "am" or "pm"
pm ditto
AM The string "AM" or "PM"
PM ditto
a.m. The string "a.m." or "p.m."
p.m. ditto
A.M. The string "A.M." or "P.M."
P.M. ditto
tz time zone abbreviation
use Test::More tests => 1;
BEGIN { use_ok('Time::Format') };
use Test::More tests => 1;
BEGIN { use_ok('Time::Format') };
#!/perl -I..
use strict;
use Test::More tests => 12;
BEGIN { $Time::Format::NOXS = 1 }
BEGIN { use_ok 'Time::Format', qw(time_format %time) }
my $manip_bad;
BEGIN
{
if (eval 'use Date::Manip (); 1')
{
# If Date::Manip can't determine the time zone, it'll bomb out of the tests.
$manip_bad = 'Date::Manip cannot determine time zone'
unless eval 'Date::Manip::Date_TimeZone(); 1';
}
else
{
$manip_bad = 'Date::Manip is not available';
}
}
# Get day/month names in current locale
my ($Thursday, $Thu, $June, $Jun);
unless (eval
{
require I18N::Langinfo;
I18N::Langinfo->import(qw(langinfo DAY_3 MON_12 DAY_5 ABDAY_5 MON_6 ABMON_6));
($Thursday, $Thu, $June, $Jun) = map ucfirst lc langinfo($_), (DAY_5(), ABDAY_5(), MON_6(), ABMON_6());
1;
})
{
($Thursday, $Thu, $June, $Jun) = qw(Thursday Thu June Jun);
}
SKIP:
{
skip $manip_bad, 11 if $manip_bad;
my $t = Date::Manip::ParseDate('June 5, 2003 at 1:58:09 pm');
# time_format tests (5)
is time_format('yyyymmdd', $t), '20030605' => 'mm month';
is time_format('hhmmss', $t), '135809' => 'mm minute';
is time_format('MONTH', $t), uc $June => 'uc month name';
is time_format('weekday', $t), lc $Thursday => 'lc weekday';
is time_format('\QToday is\E yyyy/mm/dd hh:mm:ss', $t), 'Today is 2003/06/05 13:58:09' => 'Full timestamp';
is $time{'yyyymmdd', $t}, '20030605' => 'month: mm';
is $time{'hhmmss', $t}, '135809' => 'mm minute';
is $time{'MONTH', $t}, uc $June => 'uc month name';
is $time{'weekday', $t}, lc $Thursday => 'lc weekday';
is $time{'\QToday is\E yyyy/mm/dd hh:mm:ss', $t}, 'Today is 2003/06/05 13:58:09' => 'Full timestamp';
is "$time{'\QToday is\E yyyy/mm/dd hh:mm:ss', $t}", 'Today is 2003/06/05 13:58:09' => 'Full timestamp';
}
#!/perl -I..
use strict;
use Test::More tests => 12;
BEGIN { $Time::Format::NOXS = 1 }
BEGIN { use_ok 'Time::Format', qw(time_format %time) }
my $manip_bad;
BEGIN
{
if (eval 'use Date::Manip (); 1')
{
# If Date::Manip can't determine the time zone, it'll bomb out of the tests.
$manip_bad = 'Date::Manip cannot determine time zone'
unless eval 'Date::Manip::Date_TimeZone(); 1';
}
else
{
$manip_bad = 'Date::Manip is not available';
}
}
# Get day/month names in current locale
my ($Thursday, $Thu, $June, $Jun);
unless (eval
{
require I18N::Langinfo;
I18N::Langinfo->import(qw(langinfo DAY_3 MON_12 DAY_5 ABDAY_5 MON_6 ABMON_6));
($Thursday, $Thu, $June, $Jun) = map ucfirst lc langinfo($_), (DAY_5(), ABDAY_5(), MON_6(), ABMON_6());
1;
})
{
($Thursday, $Thu, $June, $Jun) = qw(Thursday Thu June Jun);
}
SKIP:
{
skip $manip_bad, 11 if $manip_bad;
my $t = Date::Manip::ParseDate('June 5, 2003 at 1:58:09 pm');
# time_format tests (5)
is time_format('yyyymmdd', $t), '20030605' => 'mm month';
is time_format('hhmmss', $t), '135809' => 'mm minute';
is time_format('MONTH', $t), uc $June => 'uc month name';
is time_format('weekday', $t), lc $Thursday => 'lc weekday';
is time_format('\QToday is\E yyyy/mm/dd hh:mm:ss', $t), 'Today is 2003/06/05 13:58:09' => 'Full timestamp';
is $time{'yyyymmdd', $t}, '20030605' => 'month: mm';
is $time{'hhmmss', $t}, '135809' => 'mm minute';
is $time{'MONTH', $t}, uc $June => 'uc month name';
is $time{'weekday', $t}, lc $Thursday => 'lc weekday';
is $time{'\QToday is\E yyyy/mm/dd hh:mm:ss', $t}, 'Today is 2003/06/05 13:58:09' => 'Full timestamp';
is "$time{'\QToday is\E yyyy/mm/dd hh:mm:ss', $t}", 'Today is 2003/06/05 13:58:09' => 'Full timestamp';
}
#!/perl -I..
use strict;
use Test::More tests => 12;
BEGIN { $Time::Format::NOXS = 1 }
BEGIN { use_ok 'Time::Format', qw(time_format %time) }
my $datetime_notok;
BEGIN {$datetime_notok = eval('use DateTime; 1;')? 0 : 1;}
# Get day/month names in current locale
my ($Thursday, $Thu, $June, $Jun);
unless (eval