From ff924a5451382eafb2d54f4796a9aad1579f4407 Mon Sep 17 00:00:00 2001 From: Sehong Na Date: Sat, 31 May 2014 12:57:52 +0900 Subject: Initialize Tizen 2.3 --- ChangeLog | 400 ++++++++++++++++++++++++++++++++ MANIFEST | 47 ++++ META.yml | 21 ++ Makefile.PL | 23 ++ README | 28 +++ SIGNATURE | 69 ++++++ lib/Date/Format.pm | 403 +++++++++++++++++++++++++++++++++ lib/Date/Language.pm | 144 ++++++++++++ lib/Date/Language/Afar.pm | 49 ++++ lib/Date/Language/Amharic.pm | 87 +++++++ lib/Date/Language/Austrian.pm | 36 +++ lib/Date/Language/Brazilian.pm | 35 +++ lib/Date/Language/Chinese.pm | 36 +++ lib/Date/Language/Chinese_GB.pm | 36 +++ lib/Date/Language/Czech.pm | 58 +++++ lib/Date/Language/Danish.pm | 36 +++ lib/Date/Language/Dutch.pm | 40 ++++ lib/Date/Language/English.pm | 37 +++ lib/Date/Language/Finnish.pm | 45 ++++ lib/Date/Language/French.pm | 36 +++ lib/Date/Language/Gedeo.pm | 51 +++++ lib/Date/Language/German.pm | 37 +++ lib/Date/Language/Greek.pm | 91 ++++++++ lib/Date/Language/Hungarian.pm | 88 +++++++ lib/Date/Language/Icelandic.pm | 36 +++ lib/Date/Language/Italian.pm | 36 +++ lib/Date/Language/Norwegian.pm | 36 +++ lib/Date/Language/Oromo.pm | 37 +++ lib/Date/Language/Romanian.pm | 37 +++ lib/Date/Language/Russian.pm | 49 ++++ lib/Date/Language/Russian_cp1251.pm | 39 ++++ lib/Date/Language/Russian_koi8r.pm | 39 ++++ lib/Date/Language/Sidama.pm | 37 +++ lib/Date/Language/Somali.pm | 62 +++++ lib/Date/Language/Spanish.pm | 35 +++ lib/Date/Language/Swedish.pm | 41 ++++ lib/Date/Language/Tigrinya.pm | 58 +++++ lib/Date/Language/TigrinyaEritrean.pm | 93 ++++++++ lib/Date/Language/TigrinyaEthiopian.pm | 93 ++++++++ lib/Date/Language/Turkish.pm | 59 +++++ lib/Date/Parse.pm | 380 +++++++++++++++++++++++++++++++ lib/Time/Zone.pm | 291 ++++++++++++++++++++++++ packaging/perl-TimeDate.changes | 15 ++ packaging/perl-TimeDate.spec | 51 +++++ t/cpanrt.t | 55 +++++ t/date.t | 193 ++++++++++++++++ t/format.t | 184 +++++++++++++++ t/getdate.t | 209 +++++++++++++++++ t/lang.t | 24 ++ 49 files changed, 4122 insertions(+) create mode 100644 ChangeLog create mode 100644 MANIFEST create mode 100644 META.yml create mode 100644 Makefile.PL create mode 100644 README create mode 100644 SIGNATURE create mode 100644 lib/Date/Format.pm create mode 100644 lib/Date/Language.pm create mode 100644 lib/Date/Language/Afar.pm create mode 100644 lib/Date/Language/Amharic.pm create mode 100644 lib/Date/Language/Austrian.pm create mode 100644 lib/Date/Language/Brazilian.pm create mode 100644 lib/Date/Language/Chinese.pm create mode 100644 lib/Date/Language/Chinese_GB.pm create mode 100644 lib/Date/Language/Czech.pm create mode 100644 lib/Date/Language/Danish.pm create mode 100644 lib/Date/Language/Dutch.pm create mode 100644 lib/Date/Language/English.pm create mode 100644 lib/Date/Language/Finnish.pm create mode 100644 lib/Date/Language/French.pm create mode 100644 lib/Date/Language/Gedeo.pm create mode 100644 lib/Date/Language/German.pm create mode 100644 lib/Date/Language/Greek.pm create mode 100644 lib/Date/Language/Hungarian.pm create mode 100644 lib/Date/Language/Icelandic.pm create mode 100644 lib/Date/Language/Italian.pm create mode 100644 lib/Date/Language/Norwegian.pm create mode 100644 lib/Date/Language/Oromo.pm create mode 100644 lib/Date/Language/Romanian.pm create mode 100644 lib/Date/Language/Russian.pm create mode 100755 lib/Date/Language/Russian_cp1251.pm create mode 100755 lib/Date/Language/Russian_koi8r.pm create mode 100644 lib/Date/Language/Sidama.pm create mode 100644 lib/Date/Language/Somali.pm create mode 100644 lib/Date/Language/Spanish.pm create mode 100644 lib/Date/Language/Swedish.pm create mode 100644 lib/Date/Language/Tigrinya.pm create mode 100644 lib/Date/Language/TigrinyaEritrean.pm create mode 100644 lib/Date/Language/TigrinyaEthiopian.pm create mode 100755 lib/Date/Language/Turkish.pm create mode 100644 lib/Date/Parse.pm create mode 100644 lib/Time/Zone.pm create mode 100644 packaging/perl-TimeDate.changes create mode 100644 packaging/perl-TimeDate.spec create mode 100644 t/cpanrt.t create mode 100644 t/date.t create mode 100644 t/format.t create mode 100644 t/getdate.t create mode 100644 t/lang.t diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..49eca37 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,400 @@ +1.20 -- Sat Dec 12 06:38:14 CST 2009 + + * Typo => s/timezome/timezone/ [yanick] + * RT#52387 Fix %s formating to use timelocal when no timezone is given + * RT#51664 fix str2time('16 Oct 09') to not give a negative result + +1.19 -- Fri Sep 25 13:59:41 CDT 2009 + + * Replace Date::Language::Hungarian with version from CPAN by Lee Goddard + +1.18 -- Thu Sep 24 17:43:28 CDT 2009 + + * RT#49963 Skip pre 1970 date tests on Win32 + * Added Date::Language::Hungarian (Konrad Lorinczi) + +1.17 -- Sat Sep 19 10:56:12 CDT 2009 + +Bugfixes + * RT#45067: Date::Format with %z gives wrong results for half-hour timezones (Ernesto Hernndez-Novich) + * RT#48164: Date::Parse unable to set seconds correctly + * RT#17396: Parse error for french date with 'mars' (march) as month + +Documentation + * Fixed documentation for %e in Date::Format + * Update documentation to remove Date::Format->language + +Enhancements + * Add support for dates like Jul-13-1999 (Brett Warden) + * Added Icelandic language (Tomas Edwardsson) + * Added Romanian language (Doru Petrescu) + * Added Russian language (Denis Poznyakov & Danil Pismenny) + * Added Turkish language (Burak Gursoy) + * Added Spanish language (Adrian Mugnolo) + * Added Chinese language (Kang-min Liu) + * Support parsing dates like 2002-02-26-10:37:21.141 as used by lpd + * Support Z timezone when only the time is specified + * Added METDST to Time::Zone + * Added AKST/AKDT to Time::Zone + +Changes prior to 1.17 + +Change 814 on 2003/06/03 by (Graham Barr) + + Date::Parse + - Time::Local in 5.8 does not support fractional seconds + +Change 813 on 2003/06/02 by (Graham Barr) + + Release 1.15 + +Change 812 on 2003/06/02 by (Graham Barr) + + Fix comments about Language implementation in Date::Parse + (patch from Christian Hammers) + +Change 811 on 2003/06/02 by (Graham Barr) + + Fix short name for 'maart' to be 'mrt' as suggested by Frank Maas + +Change 810 on 2003/06/02 by (Graham Barr) + + Add %G format for GPS week (patch from Eric Richardson) + +Change 809 on 2003/06/02 by (Graham Barr) + + Language updates from Daniel Yacob + +Change 808 on 2003/06/02 by (Graham Barr) + + str2time("") should return undef + +Change 807 on 2003/06/02 by (Graham Barr) + + Added Swedish and Finnish languages from Matthew Musgrove + +Change 778 on 2003/03/03 by (Graham Barr) + + Added Chinese_GB language. + Supplied by forehead (I don't even pretend tounderstand it) + +Change 777 on 2003/03/03 by (Graham Barr) + + Return fractional seconds when specified in an ISO date + +Change 776 on 2003/03/03 by (Graham Barr) + + New languages from Daniel Yacob + +Change 775 on 2003/03/03 by (Graham Barr) + + Fix UTC support on ISO dates + +Change 774 on 2003/03/03 by (Graham Barr) + + Allow a : in a timezone so the dates specified in RSS can be parsed + (eg 2002-11-07T23:31:49-05:00) Patch from Kellan + +Change 773 on 2003/03/03 by (Graham Barr) + + Support parsing more formats + +Change 754 on 2002/11/03 by (Graham Barr) + + Release 1.14 + +Change 753 on 2002/11/03 by (Graham Barr) + + Fix bug parsing 2002-11-02 11pm + +Change 752 on 2002/11/03 by (Graham Barr) + + Add Greek language module from Matthew Musgrove + +Change 744 on 2002/09/16 by (Graham Barr) + + Add Date::Language::Brazilian and Date::Language::Danish + to MANIFEST + +Change 743 on 2002/09/16 by (Graham Barr) + + Add Date::Language::Brazilian from Christian Tosta + Add Date::Language::Danish from Lars Skjrlund + +Change 742 on 2002/09/16 by (Graham Barr) + + Time::Zone + - Add some zones for Brazil + +Change 741 on 2002/09/16 by (Graham Barr) + + Time::Zone [cpan #1299] + - Allow $ENV{TZ} to have zomes like EST5 + +Change 733 on 2002/06/13 by (Graham Barr) + + Date::Language::French + - Fix missing ; + +Change 732 on 2002/06/06 by (Graham Barr) + + Release 1.13 + +Change 731 on 2002/06/06 by (Graham Barr) + + Fix pattern to allow single digits for month and day (eg '2002-6-1') + +Change 730 on 2002/06/03 by (Graham Barr) + + Release 1.12 + +Change 729 on 2002/06/03 by (Graham Barr) + + Fix month name abbreviations + +Change 720 on 2002/04/25 by (Graham Barr) + + Date::Parse + - Make it work with 5.004 again + +Change 719 on 2002/04/25 by (Graham Barr) + + Prevent the ISO date pattern matching where it should not. ie there must not + be a non-space character directly before the date string + +Change 718 on 2002/04/17 by (Graham Barr) + + Change French @Dsuf, from Peter Samuelson + +Change 712 on 2002/03/07 by (Graham Barr) + + Added %L format for month number as 1..12 from Adam Monsen + +Change 708 on 2002/02/28 by (Graham Barr) + + Release 1.11 + +Change 707 on 2002/02/28 by (Graham Barr) + + Fix format error in t/date.t + +Change 692 on 2002/01/09 by (Graham Barr) + + Be a bit more lenient on the ISO format + +Change 691 on 2002/01/02 by (Graham Barr) + + Fix typo in ISO-8601 formats in docs + +Change 690 on 2001/12/28 by (Graham Barr) + + Date::Format + - Fix array dereference syntax typo + +Change 689 on 2001/12/28 by (Graham Barr) + + Date::Format + - Fix doc typos + +Change 682 on 2001/11/20 by (Graham Barr) + + Date::Parse + - Make the minutes and seconds parts of an ISO-8601 optional + (patch from Christian Hammers) + +Change 681 on 2001/11/20 by (Graham Barr) + + Date::Parse + - Allow AM/PM to be just A/P (eg Jul 13 1999 1:23P) as used by MySQL + (patch from Drew Degentesh) + +Change 680 on 2001/11/20 by (Graham Barr) + + Time::Zone + - Add CEST Central European Daylight + +Change 679 on 2001/11/20 by (Graham Barr) + + Date::Parse + - Extract (but ignore) fractions of a second in an ISO8601 date string + (patch from rayg at yahoo-inc.com) + +Change 678 on 2001/11/20 by (Graham Barr) + + Add %P to be am or pm + +Change 677 on 2001/11/20 by (Graham Barr) + + Date::Language::French + - Um, the french have 7 days in the week just like everyone else + +Change 676 on 2001/11/20 by (Graham Barr) + + Date::Language::German + - Fix abbrev for October (patch from Stefan Niederhauser) + +Change 634 on 2001/09/03 by (Graham Barr) + + Add a check for invalid years in format 1995-01-24 + +Change 580 on 2000/09/04 by (Graham Barr) + + Release 1.10 + +Change 579 on 2000/09/04 by (Graham Barr) + + Date::Parse + - Support for more date formats + + Time::Zone + - Added more zones + +Change 539 on 2000/06/14 by (Graham Barr) + + Documentation updates + +Change 536 on 2000/06/06 by (Graham Barr) + + Fix VERSION numbers + +Change 535 on 2000/06/06 by (Graham Barr) + + Date::Format + - Added support for %O* to support output of roman numerals + +Change 443 on 2000/03/29 by (Graham Barr) + + Release 1.09 + +Change 442 on 2000/03/29 by (Graham Barr) + + Added PPD stuff to Makefile.PL + +Change 441 on 2000/03/29 by (Graham Barr) + + Date::Parse + - Allow "s after the timezone + +Change 440 on 2000/03/29 by (Graham Barr) + + Date::Format + - Fix doc for %c and %C + +Change 409 on 2000/03/28 by (Graham Barr) + + Moved .pm files into lib directory + +Change 408 on 2000/03/28 by (Graham Barr) + + str2time returns undef on error bit Time::Local returns + -1. Check if the -1 is real or an error + +Change 407 on 2000/03/28 by (Graham Barr) + + Added Eastern European Summer Time EEST + +Change 268 on 1999/03/18 by (Graham Barr) + + Date::Format, Time::Zone + - Fix problem with %z and %Z as suggested by + Jason A Smith + +Change 267 on 1999/03/18 by (Graham Barr) + + - Make t/getdate.t more portable as suggested by + Paul Schinder + +Change 250 on 1999/02/06 by (Graham Barr) + + Date::Format + - Correct docs for %d and %e + +Change 249 on 1999/02/06 by (Graham Barr) + + Added Date::Language::Czech + +Change 180 on 1998/08/05 by (Graham Barr) + + Date::Language + - Added Date::Language::French contributed by + Emmanuel Bataille (bem@residents.frmug.org) + - Split out the languages into .pm's + + Date::Parse + - Added patch from Alan Burlison to Date::Parse to allow zone + offests +7, +10 and +700 + - Parse now supports GMT+0100 + +*** Release 1.08 + +Fri Jan 2 1998 (Graham Barr) + + Date::Format, Time::Zone + - Fix for formatting %z and %Z + + all + - Update Email address and year + +Tue Feb 17 1998 (Graham Barr) + + Date::Language + - Added format_o to German + +Fri Sep 12 1997 (Graham Barr) + + Date::Parse + - Added 'DST' to parser, it adjusts $zone by 3600 (but that may not + be right in all cases) + - Added a check to str2time to ensure valid + values are passed to Time::Local, to avoid croak-ing + - Fixed to treat AM and PM correctly when the hour is 12. (I hope :-) + + Time::Zone + - Modified for Western Australia + +Tue 07 Jan 1996 + + o Release 1.07 + o Fixed a problem in Time::Zone (had @l[8] instead of $l[8], doh! ) + +Thu 02 Jan 1996 + + o Release 1.06 + o Fixed t/getdate.t + o Date::Parse can now parse the date-format 960913, which apparently + is fairly common in sweden. + +Wed 31 Jul 1996 + + o Release 1.05 + o Modified Date::Format not to use single letter sub names, + all format sub names are nore prefixed with format_ + o Cleaned up Date/Format.pm so that AUTOLOAD is not required + o Patched Date/Language.pm to add Norwegian. Thanks to + Gisle Aas for the patch + +Thu 27 Jun 1996 + + o Added %z to Date::Format to output timezone in +/-0000 format + o Added multi-language support via Date::Language,. + +Tue 25 Jun 1996 + + o Some code tidying up + o added a new test, copied from Date::GetDate + o improved performance + +Wed 22 May 1996 + + o Fixed a bug in the parser for dates in a default (local) timezone + but a different dst + +Wed 15 May 1996 + + o Added support for mainframe type dates + +Fri 3 May 1996 + + o Added %s to date formatting at request of Josh Osborne + . + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..227442e --- /dev/null +++ b/MANIFEST @@ -0,0 +1,47 @@ +ChangeLog +lib/Date/Format.pm +lib/Date/Language.pm +lib/Date/Language/Afar.pm +lib/Date/Language/Amharic.pm +lib/Date/Language/Austrian.pm +lib/Date/Language/Brazilian.pm +lib/Date/Language/Chinese.pm +lib/Date/Language/Chinese_GB.pm +lib/Date/Language/Czech.pm +lib/Date/Language/Danish.pm +lib/Date/Language/Dutch.pm +lib/Date/Language/English.pm +lib/Date/Language/Finnish.pm +lib/Date/Language/French.pm +lib/Date/Language/Gedeo.pm +lib/Date/Language/German.pm +lib/Date/Language/Greek.pm +lib/Date/Language/Hungarian.pm +lib/Date/Language/Icelandic.pm +lib/Date/Language/Italian.pm +lib/Date/Language/Norwegian.pm +lib/Date/Language/Oromo.pm +lib/Date/Language/Romanian.pm +lib/Date/Language/Russian.pm +lib/Date/Language/Russian_cp1251.pm +lib/Date/Language/Russian_koi8r.pm +lib/Date/Language/Sidama.pm +lib/Date/Language/Somali.pm +lib/Date/Language/Spanish.pm +lib/Date/Language/Swedish.pm +lib/Date/Language/Tigrinya.pm +lib/Date/Language/TigrinyaEritrean.pm +lib/Date/Language/TigrinyaEthiopian.pm +lib/Date/Language/Turkish.pm +lib/Date/Parse.pm +lib/Time/Zone.pm +Makefile.PL +MANIFEST This list of files +README +t/cpanrt.t +t/date.t +t/format.t +t/getdate.t +t/lang.t +META.yml Module meta-data (added by MakeMaker) +SIGNATURE Public-key signature (added by MakeMaker) diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..6434fd5 --- /dev/null +++ b/META.yml @@ -0,0 +1,21 @@ +--- #YAML:1.0 +name: TimeDate +version: 1.20 +abstract: ~ +author: + - Graham Barr +license: perl +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +requires: {} +resources: + repository: http://github.com/gbarr/perl-TimeDate +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.48 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..c7c6034 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,23 @@ +# This -*- perl -*- script makes the Makefile + +BEGIN { require 5.004 } + +use strict; +use warnings; +use ExtUtils::MakeMaker; + +WriteMakefile( + NAME => 'TimeDate', + AUTHOR => 'Graham Barr ', + VERSION => '1.20', + (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()), + ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( + META_MERGE => { + resources => { ## + repository => 'http://github.com/gbarr/perl-TimeDate', + }, + } + ) + : () + ), +); diff --git a/README b/README new file mode 100644 index 0000000..6ed8066 --- /dev/null +++ b/README @@ -0,0 +1,28 @@ +This is the perl5 TimeDate distribution. It requires perl version 5.003 +or later + +This distribution replaces my earlier GetDate distribution, which was +only a date parser. The date parser contained in this distribution is +far superior to the yacc based parser, and a *lot* fatser. + +The parser contained here will only parse absolute dates, if you want a +date parser that can parse relative dates then take a look at the Time +modules by David Muir on CPAN. + +You install the library by running these commands: + + perl Makefile.PL + make + make test + make install + +Please report any bugs/suggestions to + +Copyright 1995-2009 Graham Barr. + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +Share and Enjoy! +Graham + diff --git a/SIGNATURE b/SIGNATURE new file mode 100644 index 0000000..b4879bb --- /dev/null +++ b/SIGNATURE @@ -0,0 +1,69 @@ +This file contains message digests of all files listed in MANIFEST, +signed via the Module::Signature module, version 0.55. + +To verify the content in this distribution, first make sure you have +Module::Signature installed, then type: + + % cpansign -v + +It will check each file's integrity, as well as the signature's +validity. If "==> Signature verified OK! <==" is not displayed, +the distribution may already have been compromised, and you should +not run its Makefile.PL or Build.PL. + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +SHA1 036da21b212a902ecb9d195565bbcd4c51bccecc ChangeLog +SHA1 efb2a90cd095d97ec148e6263fb921f560cfffb5 MANIFEST +SHA1 4efed966d43e74a6f53ef2bcdbfc4de05b92035f META.yml +SHA1 e111caf8b7da35935fa7004a17045cab55278445 Makefile.PL +SHA1 80cff3b1f65e7df95eaa1a992b688c2c5e1d2b6e README +SHA1 5ca10e18e888daf0883de553219f42ca2422763f lib/Date/Format.pm +SHA1 08342e72298e839f21236dff7555f2505f928d32 lib/Date/Language.pm +SHA1 50703aeade60a04398517416d30a2d8918c95578 lib/Date/Language/Afar.pm +SHA1 f9450ca0047510a4102c32cc4e20a435cdd85b31 lib/Date/Language/Amharic.pm +SHA1 f00534703736026830f729445d0d6f582481a05e lib/Date/Language/Austrian.pm +SHA1 c5af5f819bbd3eff3b404e62f1a3735d7e4a038b lib/Date/Language/Brazilian.pm +SHA1 e89738e9f3611a6de79cef7e791c20a05ac2a057 lib/Date/Language/Chinese.pm +SHA1 d8765df8f8368d6b467a87b1f32397d50253747a lib/Date/Language/Chinese_GB.pm +SHA1 f5061baf9b980aa0e8feefab059214775bb8182e lib/Date/Language/Czech.pm +SHA1 726c12ddd66f70ddcfd5bbdbc094777255eb2b9b lib/Date/Language/Danish.pm +SHA1 8566be869607c2b2024821def260de5a828f005f lib/Date/Language/Dutch.pm +SHA1 ab20e0b3487b85a54a3d6321b50d01d43fe78427 lib/Date/Language/English.pm +SHA1 9b057eea719ed24f643f4d284cf1fa6ae594e7dc lib/Date/Language/Finnish.pm +SHA1 105169f2848df40ac1111f0130ec1bb4b74647d8 lib/Date/Language/French.pm +SHA1 dc2f9c1cee48be3b73613ca9ed1291e9c976a37e lib/Date/Language/Gedeo.pm +SHA1 794a9b715e66fdcc428a65b2972ced4fee62b52c lib/Date/Language/German.pm +SHA1 863bb62fd08b3e61c63a2df3d65323d8e6c1b651 lib/Date/Language/Greek.pm +SHA1 8f0678fee75492f3675cf0b130fd39c7a589a552 lib/Date/Language/Hungarian.pm +SHA1 34da50806290fe731fd1e01290728fcd0b6d02a2 lib/Date/Language/Icelandic.pm +SHA1 de5069f424fed480586bc2dcff1cca1930bf98a1 lib/Date/Language/Italian.pm +SHA1 e4e81280ba513a3ab6e0bee01704913dd730c9a8 lib/Date/Language/Norwegian.pm +SHA1 13165e5b72586200a106aa2870fe92b49d94dd8c lib/Date/Language/Oromo.pm +SHA1 71eaea1d32b8fcfa23c5a815e3fa54b9f84af80c lib/Date/Language/Romanian.pm +SHA1 806f38e0789bf10f2e843c69f68bcfa50c0d78eb lib/Date/Language/Russian.pm +SHA1 292c36c93532a57b667d7deedc23cefbb9bf478c lib/Date/Language/Russian_cp1251.pm +SHA1 26efbebc7afd065da56ec09ee3b062a9ddd4a2d3 lib/Date/Language/Russian_koi8r.pm +SHA1 d1658daedcf106f01869a4371b9c3e572330f864 lib/Date/Language/Sidama.pm +SHA1 58f9ded75fc18c26eeb96ce6374e66565ad01494 lib/Date/Language/Somali.pm +SHA1 8b970f347eb0718e210d7613db5ba88b124d189e lib/Date/Language/Spanish.pm +SHA1 a52f8968a0fdf3e735d62f71b91d6b64a5f98fa3 lib/Date/Language/Swedish.pm +SHA1 5da829cf39dc01331ad58f66eced0a1f47e346b6 lib/Date/Language/Tigrinya.pm +SHA1 20fc6beb32657ca147719f713ff816bbb696da20 lib/Date/Language/TigrinyaEritrean.pm +SHA1 30f77a43a000f2ce3d22b1b633261a20289025aa lib/Date/Language/TigrinyaEthiopian.pm +SHA1 54288741c52b09ee92b0487848df74a08cdc3b9e lib/Date/Language/Turkish.pm +SHA1 b10ec48bd01b73638e4c6dce3f554e4c77267b6c lib/Date/Parse.pm +SHA1 394c7d372c25107ba5151ceca44c0599188907c7 lib/Time/Zone.pm +SHA1 ee65cf5b634d907c4cc2d414e49c06175461e6ac t/cpanrt.t +SHA1 7b16580497a96a4bc551b87b8b97ec89331e81f8 t/date.t +SHA1 bf6f4a7c599485ab11779c99fc821378e547d26d t/format.t +SHA1 acef4dd152cd391a3e7a7945c8405a50d965f335 t/getdate.t +SHA1 501dcb487e33f6b2d4577ef2e6e5f67f038d3c04 t/lang.t +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.10 (Darwin) + +iEYEARECAAYFAksjjt4ACgkQR0BL4gbYw3RCKgCePxf2QrH/3uvOofKewESV0zto +t+sAnA5dGEi945ziAfAkLyFUhIMWnm7U +=GqfE +-----END PGP SIGNATURE----- diff --git a/lib/Date/Format.pm b/lib/Date/Format.pm new file mode 100644 index 0000000..3a1ea90 --- /dev/null +++ b/lib/Date/Format.pm @@ -0,0 +1,403 @@ +# Copyright (c) 1995-2009 Graham Barr. This program is free +# software; you can redistribute it and/or modify it under the same terms +# as Perl itself. + +package Date::Format; + +use strict; +use vars qw(@EXPORT @ISA $VERSION); +require Exporter; + +$VERSION = "2.24"; +@ISA = qw(Exporter); +@EXPORT = qw(time2str strftime ctime asctime); + +sub time2str ($;$$) +{ + Date::Format::Generic->time2str(@_); +} + +sub strftime ($\@;$) +{ + Date::Format::Generic->strftime(@_); +} + +sub ctime ($;$) +{ + my($t,$tz) = @_; + Date::Format::Generic->time2str("%a %b %e %T %Y\n", $t, $tz); +} + +sub asctime (\@;$) +{ + my($t,$tz) = @_; + Date::Format::Generic->strftime("%a %b %e %T %Y\n", $t, $tz); +} + +## +## +## + +package Date::Format::Generic; + +use vars qw($epoch $tzname); +use Time::Zone; +use Time::Local; + +sub ctime +{ + my($me,$t,$tz) = @_; + $me->time2str("%a %b %e %T %Y\n", $t, $tz); +} + +sub asctime +{ + my($me,$t,$tz) = @_; + $me->strftime("%a %b %e %T %Y\n", $t, $tz); +} + +sub _subs +{ + my $fn; + $_[1] =~ s/ + %(O?[%a-zA-Z]) + / + ($_[0]->can("format_$1") || sub { $1 })->($_[0]); + /sgeox; + + $_[1]; +} + +sub strftime +{ + my($pkg,$fmt,$time); + + ($pkg,$fmt,$time,$tzname) = @_; + + my $me = ref($pkg) ? $pkg : bless []; + + if(defined $tzname) + { + $tzname = uc $tzname; + + $tzname = sprintf("%+05d",$tzname) + unless($tzname =~ /\D/); + + $epoch = timegm(@{$time}[0..5]); + + @$me = gmtime($epoch + tz_offset($tzname) - tz_offset()); + } + else + { + @$me = @$time; + undef $epoch; + } + + _subs($me,$fmt); +} + +sub time2str +{ + my($pkg,$fmt,$time); + + ($pkg,$fmt,$time,$tzname) = @_; + + my $me = ref($pkg) ? $pkg : bless [], $pkg; + + $epoch = $time; + + if(defined $tzname) + { + $tzname = uc $tzname; + + $tzname = sprintf("%+05d",$tzname) + unless($tzname =~ /\D/); + + $time += tz_offset($tzname); + @$me = gmtime($time); + } + else + { + @$me = localtime($time); + } + $me->[9] = $time; + _subs($me,$fmt); +} + +my(@DoW,@MoY,@DoWs,@MoYs,@AMPM,%format,@Dsuf); + +@DoW = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); + +@MoY = qw(January February March April May June + July August September October November December); + +@DoWs = map { substr($_,0,3) } @DoW; +@MoYs = map { substr($_,0,3) } @MoY; + +@AMPM = qw(AM PM); + +@Dsuf = (qw(th st nd rd th th th th th th)) x 3; +@Dsuf[11,12,13] = qw(th th th); +@Dsuf[30,31] = qw(th st); + +%format = ('x' => "%m/%d/%y", + 'C' => "%a %b %e %T %Z %Y", + 'X' => "%H:%M:%S", + ); + +my @locale; +my $locale = "/usr/share/lib/locale/LC_TIME/default"; +local *LOCALE; + +if(open(LOCALE,"$locale")) + { + chop(@locale = ); + close(LOCALE); + + @MoYs = @locale[0 .. 11]; + @MoY = @locale[12 .. 23]; + @DoWs = @locale[24 .. 30]; + @DoW = @locale[31 .. 37]; + @format{"X","x","C"} = @locale[38 .. 40]; + @AMPM = @locale[41 .. 42]; + } + +sub wkyr { + my($wstart, $wday, $yday) = @_; + $wday = ($wday + 7 - $wstart) % 7; + return int(($yday - $wday + 13) / 7 - 1); +} + +## +## these 6 formatting routins need to be *copied* into the language +## specific packages +## + +my @roman = ('',qw(I II III IV V VI VII VIII IX)); +sub roman { + my $n = shift; + + $n =~ s/(\d)$//; + my $r = $roman[ $1 ]; + + if($n =~ s/(\d)$//) { + (my $t = $roman[$1]) =~ tr/IVX/XLC/; + $r = $t . $r; + } + if($n =~ s/(\d)$//) { + (my $t = $roman[$1]) =~ tr/IVX/CDM/; + $r = $t . $r; + } + if($n =~ s/(\d)$//) { + (my $t = $roman[$1]) =~ tr/IVX/M../; + $r = $t . $r; + } + $r; +} + +sub format_a { $DoWs[$_[0]->[6]] } +sub format_A { $DoW[$_[0]->[6]] } +sub format_b { $MoYs[$_[0]->[4]] } +sub format_B { $MoY[$_[0]->[4]] } +sub format_h { $MoYs[$_[0]->[4]] } +sub format_p { $_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0] } +sub format_P { lc($_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0]) } + +sub format_d { sprintf("%02d",$_[0]->[3]) } +sub format_e { sprintf("%2d",$_[0]->[3]) } +sub format_H { sprintf("%02d",$_[0]->[2]) } +sub format_I { sprintf("%02d",$_[0]->[2] % 12 || 12)} +sub format_j { sprintf("%03d",$_[0]->[7] + 1) } +sub format_k { sprintf("%2d",$_[0]->[2]) } +sub format_l { sprintf("%2d",$_[0]->[2] % 12 || 12)} +sub format_L { $_[0]->[4] + 1 } +sub format_m { sprintf("%02d",$_[0]->[4] + 1) } +sub format_M { sprintf("%02d",$_[0]->[1]) } +sub format_q { sprintf("%01d",int($_[0]->[4] / 3) + 1) } +sub format_s { + $epoch = timelocal(@{$_[0]}[0..5]) + unless defined $epoch; + sprintf("%d",$epoch) +} +sub format_S { sprintf("%02d",$_[0]->[0]) } +sub format_U { wkyr(0, $_[0]->[6], $_[0]->[7]) } +sub format_w { $_[0]->[6] } +sub format_W { wkyr(1, $_[0]->[6], $_[0]->[7]) } +sub format_y { sprintf("%02d",$_[0]->[5] % 100) } +sub format_Y { sprintf("%04d",$_[0]->[5] + 1900) } + +sub format_Z { + my $o = tz_local_offset(timelocal(@{$_[0]}[0..5])); + defined $tzname ? $tzname : uc tz_name($o, $_[0]->[8]); +} + +sub format_z { + my $t = timelocal(@{$_[0]}[0..5]); + my $o = defined $tzname ? tz_offset($tzname, $t) : tz_offset(undef,$t); + sprintf("%+03d%02d", int($o / 3600), int(abs($o) % 3600) / 60); +} + +sub format_c { &format_x . " " . &format_X } +sub format_D { &format_m . "/" . &format_d . "/" . &format_y } +sub format_r { &format_I . ":" . &format_M . ":" . &format_S . " " . &format_p } +sub format_R { &format_H . ":" . &format_M } +sub format_T { &format_H . ":" . &format_M . ":" . &format_S } +sub format_t { "\t" } +sub format_n { "\n" } +sub format_o { sprintf("%2d%s",$_[0]->[3],$Dsuf[$_[0]->[3]]) } +sub format_x { my $f = $format{'x'}; _subs($_[0],$f); } +sub format_X { my $f = $format{'X'}; _subs($_[0],$f); } +sub format_C { my $f = $format{'C'}; _subs($_[0],$f); } + +sub format_Od { roman(format_d(@_)) } +sub format_Oe { roman(format_e(@_)) } +sub format_OH { roman(format_H(@_)) } +sub format_OI { roman(format_I(@_)) } +sub format_Oj { roman(format_j(@_)) } +sub format_Ok { roman(format_k(@_)) } +sub format_Ol { roman(format_l(@_)) } +sub format_Om { roman(format_m(@_)) } +sub format_OM { roman(format_M(@_)) } +sub format_Oq { roman(format_q(@_)) } +sub format_Oy { roman(format_y(@_)) } +sub format_OY { roman(format_Y(@_)) } + +sub format_G { int(($_[0]->[9] - 315993600) / 604800) } + +1; +__END__ + +=head1 NAME + +Date::Format - Date formating subroutines + +=head1 SYNOPSIS + + use Date::Format; + + @lt = localtime(time); + + print time2str($template, time); + print strftime($template, @lt); + + print time2str($template, time, $zone); + print strftime($template, @lt, $zone); + + print ctime(time); + print asctime(@lt); + + print ctime(time, $zone); + print asctime(@lt, $zone); + +=head1 DESCRIPTION + +This module provides routines to format dates into ASCII strings. They +correspond to the C library routines C and C. + +=over 4 + +=item time2str(TEMPLATE, TIME [, ZONE]) + +C converts C