Hello community,

here is the log from the commit of package perl-Time-Duration for 
openSUSE:Factory checked in at 2015-04-15 16:27:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Time-Duration (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Time-Duration.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Time-Duration"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Time-Duration/perl-Time-Duration.changes    
2011-12-20 14:30:40.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.perl-Time-Duration.new/perl-Time-Duration.changes   
    2015-04-15 16:27:21.000000000 +0200
@@ -1,0 +2,10 @@
+Tue Apr 14 19:16:50 UTC 2015 - co...@suse.com
+
+- updated to 1.1
+   see /usr/share/doc/packages/perl-Time-Duration/ChangeLog
+
+  2013-04-02  Avi Finkel     a...@finkel.org
+  
+       * Release 1.1 -- Adding millisecond support.
+
+-------------------------------------------------------------------

Old:
----
  Time-Duration-1.06.tar.gz

New:
----
  Time-Duration-1.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Time-Duration.spec ++++++
--- /var/tmp/diff_new_pack.F9FLV2/_old  2015-04-15 16:27:22.000000000 +0200
+++ /var/tmp/diff_new_pack.F9FLV2/_new  2015-04-15 16:27:22.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Time-Duration
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,59 +17,66 @@
 
 
 Name:           perl-Time-Duration
-Url:            http://cpan.org/modules/by-module/Time/
-BuildRequires:  perl-Pod-Coverage
-BuildRequires:  perl-Pod-Escapes
-BuildRequires:  perl-Pod-Simple
-BuildRequires:  perl-Test-Pod
-BuildRequires:  perl-Test-Pod-Coverage
-BuildRequires:  perl-macros
-Summary:        Rounded or exact English expression of durations
+Version:        1.1
+Release:        0
+%define cpan_name Time-Duration
+Summary:        rounded or exact English expression of durations
 License:        Artistic-1.0 or GPL-1.0+
 Group:          Development/Libraries/Perl
-Version:        1.06
-Release:        0
-Source:         Time-Duration-%{version}.tar.gz
+Url:            http://search.cpan.org/dist/Time-Duration/
+Source:         
http://www.cpan.org/authors/id/A/AV/AVIF/%{cpan_name}-%{version}.tar.gz
+BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  perl
+BuildRequires:  perl-macros
+BuildRequires:  perl(Test::Pod)
+BuildRequires:  perl(Test::Pod::Coverage)
 %{perl_requires}
 
 %description
-This module provides functions for expressing durations in rounded or
-exact terms.
-
+This module provides functions for expressing durations in rounded or exact
+terms.
 
+In the first example in the Synopsis, using duration($interval_seconds):
 
-Authors:
---------
-    Sean M. Burke <sbu...@cpan.org>
-    Avi Finkel <a...@finkel.org>
+If the 'time() - $start_time' is 3 seconds, this prints "Runtime: *3
+seconds*.". If it's 0 seconds, it's "Runtime: *0 seconds*.". If it's 1
+second, it's "Runtime: *1 second*.". If it's 125 seconds, you get "Runtime:
+*2 minutes and 5 seconds*.". If it's 3820 seconds (which is exactly 1h, 3m,
+40s), you get it rounded to fit within two expressed units: "Runtime: *1
+hour and 4 minutes*.". Using duration_exact instead would return "Runtime:
+*1 hour, 3 minutes, and 40 seconds*".
+
+In the second example in the Synopsis, using ago($interval_seconds):
+
+If the $age is 3 seconds, this prints "_file_ was modified *3 seconds
+ago*". If it's 0 seconds, it's "_file_ was modified *just now*", as a
+special case. If it's 1 second, it's "from *1 second ago*". If it's 125
+seconds, you get "_file_ was modified *2 minutes and 5 seconds ago*". If
+it's 3820 seconds (which is exactly 1h, 3m, 40s), you get it rounded to fit
+within two expressed units: "_file_ was modified *1 hour and 4 minutes
+ago*". Using ago_exact instead would return "_file_ was modified *1 hour, 3
+minutes, and 40 seconds ago*". And if the file's modtime is, surprisingly,
+three seconds into the future, $age is -3, and you'll get the equally and
+appropriately surprising "_file_ was modified *3 seconds from now*."
 
 %prep
-%setup -q -n Time-Duration-%{version}
-# ---------------------------------------------------------------------------
+%setup -q -n %{cpan_name}-%{version}
 
 %build
-#disable tests that need special modules
-mv t/02_pod.t t/02_pod.tt
-mv t/03_pod_cover.t t/03_pod_cover.tt
-perl Makefile.PL
-make %{?_smp_mflags}
+%{__perl} Makefile.PL INSTALLDIRS=vendor
+%{__make} %{?_smp_mflags}
 
 %check
-make test
-# ---------------------------------------------------------------------------
+%{__make} test
 
 %install
-rm -rf $RPM_BUILD_ROOT
-make CFLAGS="$RPM_OPT_FLAGS" DESTDIR=$RPM_BUILD_ROOT install_vendor
+%perl_make_install
 %perl_process_packlist
+%perl_gen_filelist
 
-%files
-%defattr(-,root,root)
-%{perl_vendorlib}/Time
-%{perl_vendorarch}/auto/Time
-#%{perl_vendorarch}/auto/Time/Duration
-%doc %{_mandir}/man3/*.gz
-%doc README
+%files -f %{name}.files
+%defattr(-,root,root,755)
+%doc ChangeLog README
 
 %changelog

++++++ Time-Duration-1.06.tar.gz -> Time-Duration-1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Time-Duration-1.06/ChangeLog 
new/Time-Duration-1.1/ChangeLog
--- old/Time-Duration-1.06/ChangeLog    2007-08-19 02:31:38.000000000 +0200
+++ new/Time-Duration-1.1/ChangeLog     2013-04-03 01:31:08.000000000 +0200
@@ -1,16 +1,20 @@
 Revision history for Perl extension Time::Duration
 
+2013-04-02  Avi Finkel     a...@finkel.org
+
+       * Release 1.1 -- Adding millisecond support.
+
 2007-08-18  Avi Finkel     a...@finkel.org
 
-  * Release 1.06 -- Fixing Makefile
+       * Release 1.06 -- Fixing Makefile
 
 2006-07-23  Avi Finkel     a...@finkel.org
 
-  * Release 1.04 -- Reorganizing tests
+       * Release 1.04 -- Reorganizing tests
 
 2006-02-28  Avi Finkel     a...@finkel.org
 
-  * Release 1.03 -- Updating new maintainer information.
+       * Release 1.03 -- Updating new maintainer information.
 
 2002-10-08  Sean M. Burke  sbu...@cpan.org
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Time-Duration-1.06/Duration.pm 
new/Time-Duration-1.1/Duration.pm
--- old/Time-Duration-1.06/Duration.pm  2007-08-19 02:30:15.000000000 +0200
+++ new/Time-Duration-1.1/Duration.pm   2013-04-03 01:30:46.000000000 +0200
@@ -1,7 +1,7 @@
 
 package Time::Duration;
 # POD is at the end.
-$VERSION = '1.06';
+$VERSION = '1.1';
 require Exporter;
 @ISA = ('Exporter');
 @EXPORT = qw( later later_exact earlier earlier_exact
@@ -14,16 +14,19 @@
 use strict;
 use constant DEBUG => 0;
 
+our $MILLISECOND = 0;
+
 # ALL SUBS ARE PURE FUNCTIONS
 
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 sub concise ($) {
   my $string = $_[0];
-  #print "in : $string\n";
+  DEBUG and print "in : $string\n";
   $string =~ tr/,//d;
   $string =~ s/\band\b//;
   $string =~ s/\b(year|day|hour|minute|second)s?\b/substr($1,0,1)/eg;
+  $string =~ s/\b(millisecond)s?\b/ms/g;
   $string =~ s/\s*(\d+)\s*/$1/g;
   return $string;
 }
@@ -66,21 +69,21 @@
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 sub interval_exact {
-  my $span = $_[0];                      # interval, in seconds
-                                         # precision is ignored
-  my $direction = ($span <= -1) ? $_[2]  # what a neg number gets
-                : ($span >=  1) ? $_[3]  # what a pos number gets
-                : return          $_[4]; # what zero gets
+  my $span = $_[0];                    # interval, in seconds
+                                       # precision is ignored
+  my $direction = ($span < 0) ? $_[2]  # what a neg number gets
+                : ($span > 0) ? $_[3]  # what a pos number gets
+                : return        $_[4]; # what zero gets
   _render($direction,
           _separate($span));
 }
 
 sub interval {
-  my $span = $_[0];                      # interval, in seconds
-  my $precision = int($_[1] || 0) || 2;  # precision (default: 2)
-  my $direction = ($span <= -1) ? $_[2]  # what a neg number gets
-                : ($span >=  1) ? $_[3]  # what a pos number gets
-                : return          $_[4]; # what zero gets
+  my $span = $_[0];                     # interval, in seconds
+  my $precision = int($_[1] || 0) || 2; # precision (default: 2)
+  my $direction = ($span < 0) ? $_[2]   # what a neg number gets
+                : ($span > 0) ? $_[3]   # what a pos number gets
+                : return        $_[4];  # what zero gets
   _render($direction,
           _approximate($precision,
                        _separate($span)));
@@ -123,6 +126,13 @@
   $remainder -= $this * 60;
   
   push @wheel, ['second', int($remainder), 60];
+
+       # Thanks to Steven Haryanto (http://search.cpan.org/~sharyanto/) for 
the basis of this change.
+       if ($MILLISECOND) {
+               $remainder -= int($remainder);
+               push @wheel, ['millisecond', sprintf("%0.f", $remainder * 
1000), 1000];
+       }
+
   return @wheel;
 }
 
@@ -274,6 +284,22 @@
 and you'll get the equally and appropriately surprising
 "I<file> was modified B<3 seconds from now>."
 
+=head1 MILLISECOND MODE
+
+By default, this module assumes input is an integer representing number
+of seconds and only emits results based on the integer part of any
+floating-point values passed to it.  However, if you set the variable
+C<$Time::Duration::MILLISECOND> to any true value, then the methods will
+interpret inputs as floating-point numbers and will emit results containing
+information about the number of milliseconds in the value.
+
+For example, C<duration(1.021)> will return B<1 second and 21 milliseconds>
+in this mode.
+
+Millisecond mode is not enabled by default because this module sees heavy use
+and existing users of it may be relying on its implicit truncation of 
non-integer
+arguments.
+
 
 =head1 FUNCTIONS
 
@@ -428,9 +454,10 @@
 
 =head1 COPYRIGHT AND DISCLAIMER
 
-Copyright 2006, Sean M. Burke C<sbu...@cpan.org>, all rights
-reserved.  This program is free software; you can redistribute it
-and/or modify it under the same terms as Perl itself.
+Copyright 2013, Sean M. Burke C<sbu...@cpan.org>; Avi Finkel,
+C<a...@finkel.org>, all rights reserved.  This program is free
+software; you can redistribute it and/or modify it under the
+same terms as Perl itself.
 
 This program is distributed in the hope that it will be useful,
 but without any warranty; without even the implied warranty of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Time-Duration-1.06/MANIFEST 
new/Time-Duration-1.1/MANIFEST
--- old/Time-Duration-1.06/MANIFEST     2007-08-19 02:30:45.000000000 +0200
+++ new/Time-Duration-1.1/MANIFEST      2013-03-27 18:37:56.000000000 +0100
@@ -18,3 +18,4 @@
 t/01_tdur.t
 t/02_pod.t
 t/03_pod_cover.t
+t/04_tdur_ms.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Time-Duration-1.06/t/04_tdur_ms.t 
new/Time-Duration-1.1/t/04_tdur_ms.t
--- old/Time-Duration-1.06/t/04_tdur_ms.t       1970-01-01 01:00:00.000000000 
+0100
+++ new/Time-Duration-1.1/t/04_tdur_ms.t        2013-04-03 01:20:17.000000000 
+0200
@@ -0,0 +1,63 @@
+use strict;
+use Test;
+
+my @them;
+BEGIN { plan('tests' => 20) };
+BEGIN { print "# Perl version $] under $^O\n" }
+
+use Time::Duration;
+ok 1;
+print "# Time::Duration version $Time::Duration::VERSION\n";
+
+use constant MINUTE =>   60;
+use constant HOUR   => 3600;
+use constant DAY    =>   24 * HOUR;
+use constant YEAR   =>  365 * DAY;
+
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+print "# Millisecond mode disabled...\n";
+
+ok( sub{duration(1.001)}, '1 second');
+
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+print "# Basic millisecond tests...\n";
+
+$Time::Duration::MILLISECOND = 1;
+
+ok( sub{duration(1.001)}, '1 second and 1 millisecond');
+ok( sub{duration(1.021)}, '1 second and 21 milliseconds');
+
+ok( sub{later(  2.001)}, '2 seconds and 1 millisecond later');
+ok( sub{later(  2.021)}, '2 seconds and 21 milliseconds later');
+ok( sub{earlier(2.001)}, '2 seconds and 1 millisecond earlier');
+ok( sub{earlier(2.021)}, '2 seconds and 21 milliseconds earlier');
+  
+ok( sub{ago(     2.001)}, '2 seconds and 1 millisecond ago');
+ok( sub{ago(     2.021)}, '2 seconds and 21 milliseconds ago');
+ok( sub{from_now(2.001)}, '2 seconds and 1 millisecond from now');
+ok( sub{from_now(2.021)}, '2 seconds and 21 milliseconds from now');
+
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+print "# Advanced millisecond tests...\n";
+
+my $v;  #scratch var
+
+$v = 61.02;
+ok(sub {later(       $v   )}, '1 minute and 1 second later');
+ok(sub {later(       $v, 3)}, '1 minute, 1 second, and 20 milliseconds later');
+ok(sub {later_exact( $v   )}, '1 minute, 1 second, and 20 milliseconds later');
+
+$v = DAY + - HOUR + -28.802 + YEAR;
+ok(sub {later(       $v   )}, '1 year and 23 hours later');
+ok(sub {later(       $v, 3)}, '1 year and 23 hours later');
+ok(sub {later_exact( $v   )}, '1 year, 22 hours, 59 minutes, 31 seconds, and 
198 milliseconds later');
+
+#~~~~~~~~
+
+print "# Some tests of concise() ...\n";
+
+ok( sub{concise duration(   1.021)}, '1s21ms');
+ok( sub{concise duration(  -1.021)}, '1s21ms');
+  
+print "# Done with all of ", __FILE__, "\n";
+


Reply via email to