r54534 - in /trunk/libtime-piece-perl: ./ debian/ debian/patches/ debian/source/ t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Fri Mar 19 02:24:45 UTC 2010
Author: jawnsy-guest
Date: Fri Mar 19 02:24:39 2010
New Revision: 54534
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54534
Log:
* Use new 3.0 (quilt) source format
* Refresh patches
Added:
trunk/libtime-piece-perl/debian/source/
trunk/libtime-piece-perl/debian/source/format
Removed:
trunk/libtime-piece-perl/debian/README.source
Modified:
trunk/libtime-piece-perl/Changes
trunk/libtime-piece-perl/META.yml
trunk/libtime-piece-perl/Piece.pm
trunk/libtime-piece-perl/Piece.xs
trunk/libtime-piece-perl/Seconds.pm
trunk/libtime-piece-perl/debian/changelog
trunk/libtime-piece-perl/debian/control
trunk/libtime-piece-perl/debian/patches/fix-pod-spelling.patch
trunk/libtime-piece-perl/debian/patches/manpage_fix_chars.patch
trunk/libtime-piece-perl/debian/rules
trunk/libtime-piece-perl/t/02core.t
Modified: trunk/libtime-piece-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Changes?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Changes (original)
+++ trunk/libtime-piece-perl/Changes Fri Mar 19 02:24:39 2010
@@ -1,5 +1,10 @@
+Time::Piece Changes
-Time::Piece Changes
+1.20
+ - Fix for alloca broke Solaris
+ - Fixed documentation buggette about strptime
+ - Added ->pretty() method for Time::Seconds objects
+ - Add %s support to strptime
1.19
- Fix for alloca broke FreeBSD
Modified: trunk/libtime-piece-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/META.yml?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/META.yml (original)
+++ trunk/libtime-piece-perl/META.yml Fri Mar 19 02:24:39 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Time-Piece
-version: 1.19
+version: 1.20
abstract: Object Oriented time objects
license: ~
author:
Modified: trunk/libtime-piece-perl/Piece.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Piece.pm?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Piece.pm (original)
+++ trunk/libtime-piece-perl/Piece.pm Fri Mar 19 02:24:39 2010
@@ -1,5 +1,3 @@
-# $Id: Piece.pm 93 2010-02-10 22:37:00Z matt $
-
package Time::Piece;
use strict;
@@ -21,7 +19,7 @@
':override' => 'internal',
);
-our $VERSION = '1.19';
+our $VERSION = '1.20';
bootstrap Time::Piece $VERSION;
@@ -786,10 +784,10 @@
=head2 Date Parsing
-Time::Piece links to your C library's strptime() function, allowing
+Time::Piece has a built-in strptime() function (from FreeBSD), allowing
you incredibly flexible date parsing routines. For example:
- my $t = Time::Piece->strptime("Sun 3rd Nov, 1943",
+ my $t = Time::Piece->strptime("Sunday 3rd Nov, 1943",
"%A %drd %b, %Y");
print $t->strftime("%a, %d %b %Y");
@@ -802,6 +800,8 @@
For more information see "man strptime", which should be on all unix
systems.
+
+Alternatively look here: http://www.unix.com/man-page/FreeBSD/3/strftime/
=head2 YYYY-MM-DDThh:mm:ss
Modified: trunk/libtime-piece-perl/Piece.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Piece.xs?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Piece.xs (original)
+++ trunk/libtime-piece-perl/Piece.xs Fri Mar 19 02:24:39 2010
@@ -314,8 +314,8 @@
#define alloca _alloca
#endif
#else
-#if defined(_SGIAPI) || defined( __sgi )
-/* required for IRIX */
+#if defined(_SGIAPI) || defined( __sgi ) || ( defined (__SVR4) && defined (__sun) )
+/* required for IRIX and Solaris */
#include <alloca.h>
#endif
#endif
@@ -467,13 +467,17 @@
len;
int Ealternative, Oalternative;
+ /* There seems to be a slightly improved version at
+ * http://www.opensource.apple.com/source/Libc/Libc-583/stdtime/strptime-fbsd.c
+ * which we may end up borrowing more from
+ */
ptr = fmt;
while (*ptr != 0) {
if (*buf == 0)
break;
c = *ptr++;
-
+
if (c != '%') {
if (isspace((unsigned char)c))
while (*buf != 0 && isspace((unsigned char)*buf))
@@ -563,6 +567,14 @@
return 0;
break;
+ case 'n': /* whitespace */
+ case 't':
+ if (!isspace((unsigned char)*buf))
+ return 0;
+ while (isspace((unsigned char)*buf))
+ buf++;
+ break;
+
case 'T':
buf = _strptime(aTHX_ buf, "%H:%M:%S", tm);
if (buf == 0)
@@ -639,7 +651,7 @@
* XXX The %l specifier may gobble one too many
* digits if used incorrectly.
*/
- if (!isdigit((unsigned char)*buf))
+ if (!isdigit((unsigned char)*buf))
return 0;
len = 2;
@@ -666,7 +678,7 @@
* XXX This is bogus if parsed before hour-related
* specifiers.
*/
- len = strlen(Locale->am);
+ len = strlen(Locale->am);
if (strncasecmp(buf, Locale->am, len) == 0) {
if (tm->tm_hour > 12)
return 0;
@@ -720,7 +732,7 @@
* point to calculate a real value, so just check the
* range for now.
*/
- if (!isdigit((unsigned char)*buf))
+ if (!isdigit((unsigned char)*buf))
return 0;
len = 2;
@@ -834,6 +846,38 @@
if (*buf != 0 && isspace((unsigned char)*buf))
while (*ptr != 0 && !isspace((unsigned char)*ptr))
ptr++;
+ break;
+
+ case 's':
+ {
+ char *cp;
+ int sverrno;
+ long n;
+ time_t t;
+ struct tm mytm;
+
+ sverrno = errno;
+ errno = 0;
+ n = strtol(buf, &cp, 10);
+ if (errno == ERANGE || (long)(t = n) != n) {
+ errno = sverrno;
+ return 0;
+ }
+ errno = sverrno;
+ buf = cp;
+ memset(&mytm, 0, sizeof(mytm));
+ my_init_tm(&mytm); /* XXX workaround - see my_init_tm() above */
+ mytm = *gmtime(&t);
+ tm->tm_sec = mytm.tm_sec;
+ tm->tm_min = mytm.tm_min;
+ tm->tm_hour = mytm.tm_hour;
+ tm->tm_mday = mytm.tm_mday;
+ tm->tm_mon = mytm.tm_mon;
+ tm->tm_year = mytm.tm_year;
+ tm->tm_wday = mytm.tm_wday;
+ tm->tm_yday = mytm.tm_yday;
+ tm->tm_isdst = mytm.tm_isdst;
+ }
break;
case 'Y':
@@ -1037,7 +1081,7 @@
mytm = *gmtime(&t);
remainder = (char *)our_strptime(aTHX_ string, format, &mytm);
if (remainder == NULL) {
- croak("Error parsing time");
+ croak("Error parsing time");
}
if (*remainder != '\0') {
warn("garbage at end of string in strptime: %s", remainder);
Modified: trunk/libtime-piece-perl/Seconds.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Seconds.pm?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Seconds.pm (original)
+++ trunk/libtime-piece-perl/Seconds.pm Fri Mar 19 02:24:39 2010
@@ -1,25 +1,22 @@
-# $Id: Seconds.pm 69 2006-09-07 17:41:05Z matt $
-
package Time::Seconds;
use strict;
use vars qw/@EXPORT @EXPORT_OK @ISA/;
-use UNIVERSAL qw(isa);
@ISA = 'Exporter';
@EXPORT = qw(
- ONE_MINUTE
- ONE_HOUR
- ONE_DAY
- ONE_WEEK
- ONE_MONTH
- ONE_REAL_MONTH
- ONE_YEAR
- ONE_REAL_YEAR
- ONE_FINANCIAL_MONTH
- LEAP_YEAR
- NON_LEAP_YEAR
- );
+ ONE_MINUTE
+ ONE_HOUR
+ ONE_DAY
+ ONE_WEEK
+ ONE_MONTH
+ ONE_REAL_MONTH
+ ONE_YEAR
+ ONE_REAL_YEAR
+ ONE_FINANCIAL_MONTH
+ LEAP_YEAR
+ NON_LEAP_YEAR
+);
@EXPORT_OK = qw(cs_sec cs_mon);
@@ -41,10 +38,10 @@
use overload
'fallback' => 'undef',
- '0+' => \&seconds,
- '""' => \&seconds,
- '<=>' => \&compare,
- '+' => \&add,
+ '0+' => \&seconds,
+ '""' => \&seconds,
+ '<=>' => \&compare,
+ '+' => \&add,
'-' => \&subtract,
'-=' => \&subtract_from,
'+=' => \&add_to,
@@ -148,6 +145,32 @@
sub years {
my $s = shift;
$s->days / 365.24225;
+}
+
+sub pretty {
+ my $s = shift;
+ my $str = "";
+ if ($s < 0) {
+ $s = -$s;
+ $str = "minus ";
+ }
+ if ($s >= ONE_MINUTE) {
+ if ($s >= ONE_HOUR) {
+ if ($s >= ONE_DAY) {
+ my $days = sprintf("%d", $s->days); # does a "floor"
+ $str = $days . " days, ";
+ $s -= ($days * ONE_DAY);
+ }
+ my $hours = sprintf("%d", $s->hours);
+ $str .= $hours . " hours, ";
+ $s -= ($hours * ONE_HOUR);
+ }
+ my $mins = sprintf("%d", $s->minutes);
+ $str .= $mins . " minutes, ";
+ $s -= ($mins * ONE_MINUTE);
+ }
+ $str .= $s->seconds . " seconds";
+ return $str;
}
1;
@@ -183,9 +206,9 @@
ONE_WEEK
ONE_HOUR
ONE_MINUTE
- ONE_MONTH
- ONE_YEAR
- ONE_FINANCIAL_MONTH
+ ONE_MONTH
+ ONE_YEAR
+ ONE_FINANCIAL_MONTH
LEAP_YEAR
NON_LEAP_YEAR
@@ -205,6 +228,9 @@
$val->months;
$val->financial_months; # 30 days
$val->years;
+ $val->pretty; # gives English representation of the delta
+
+The usual arithmetic (+,-,+=,-=) is also available on the objects.
The methods make the assumption that there are 24 hours in a day, 7 days in
a week, 365.24225 days in a year and 12 months in a year.
Modified: trunk/libtime-piece-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/debian/changelog?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/debian/changelog (original)
+++ trunk/libtime-piece-perl/debian/changelog Fri Mar 19 02:24:39 2010
@@ -1,12 +1,10 @@
-libtime-piece-perl (1.19-1) UNRELEASED; urgency=low
-
- Fixes only affect IRIX and FreeBSD, I don't think this warrants
- an upload
- IGNORE-VERSION: 1.19-1
-
- * New upstream release
-
- -- Jonathan Yu <jawnsy at cpan.org> Wed, 10 Feb 2010 21:15:50 -0500
+libtime-piece-perl (1.20-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ * Use new 3.0 (quilt) source format
+ * Refresh patches
+
+ -- Jonathan Yu <jawnsy at cpan.org> Thu, 18 Mar 2010 22:55:47 -0400
libtime-piece-perl (1.17-1) unstable; urgency=low
Modified: trunk/libtime-piece-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/debian/control?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/debian/control (original)
+++ trunk/libtime-piece-perl/debian/control Fri Mar 19 02:24:39 2010
@@ -1,7 +1,7 @@
Source: libtime-piece-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 7.0.8), quilt (>= 0.46-7), perl
+Build-Depends: debhelper (>= 7), perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Krzysztof Krzyzaniak (eloy) <eloy at debian.org>,
gregor herrmann <gregoa at debian.org>, Niko Tyni <ntyni at debian.org>,
Modified: trunk/libtime-piece-perl/debian/patches/fix-pod-spelling.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/debian/patches/fix-pod-spelling.patch?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/debian/patches/fix-pod-spelling.patch (original)
+++ trunk/libtime-piece-perl/debian/patches/fix-pod-spelling.patch Fri Mar 19 02:24:39 2010
@@ -4,7 +4,7 @@
Forwarded: no
--- a/Piece.pm
+++ b/Piece.pm
-@@ -730,7 +730,7 @@
+@@ -728,7 +728,7 @@
my $french_day = localtime->day(@days);
Modified: trunk/libtime-piece-perl/debian/patches/manpage_fix_chars.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/debian/patches/manpage_fix_chars.patch?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/debian/patches/manpage_fix_chars.patch (original)
+++ trunk/libtime-piece-perl/debian/patches/manpage_fix_chars.patch Fri Mar 19 02:24:39 2010
@@ -2,7 +2,7 @@
--- a/Seconds.pm
+++ b/Seconds.pm
-@@ -216,7 +216,7 @@
+@@ -242,7 +242,7 @@
Tobias Brox, tobiasb at tobiasb.funcom.com
Modified: trunk/libtime-piece-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/debian/rules?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/debian/rules (original)
+++ trunk/libtime-piece-perl/debian/rules Fri Mar 19 02:24:39 2010
@@ -1,4 +1,4 @@
#!/usr/bin/make -f
%:
- dh --with quilt $@
+ dh $@
Added: trunk/libtime-piece-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/debian/source/format?rev=54534&op=file
==============================================================================
--- trunk/libtime-piece-perl/debian/source/format (added)
+++ trunk/libtime-piece-perl/debian/source/format Fri Mar 19 02:24:39 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)
Modified: trunk/libtime-piece-perl/t/02core.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/t/02core.t?rev=54534&op=diff
==============================================================================
--- trunk/libtime-piece-perl/t/02core.t (original)
+++ trunk/libtime-piece-perl/t/02core.t Fri Mar 19 02:24:39 2010
@@ -219,3 +219,4 @@
'==',
951827696
);
+
More information about the Pkg-perl-cvs-commits
mailing list