[freeside-commits] branch FREESIDE_3_BRANCH updated. bd2e6496db7c18adbc7219d4ed104aab6beda56e
Mark Wells
mark at 420.am
Thu Sep 19 13:34:14 PDT 2013
The branch, FREESIDE_3_BRANCH has been updated
via bd2e6496db7c18adbc7219d4ed104aab6beda56e (commit)
from f691b3f414bfc0a07a3b5967e159403e1cfca960 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bd2e6496db7c18adbc7219d4ed104aab6beda56e
Author: Mark Wells <mark at freeside.biz>
Date: Thu Sep 19 13:33:26 2013 -0700
more accurate calculation of package start delays, #20686
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 3e63338..184f1cb 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -5,7 +5,8 @@ use strict;
use vars qw( %plans $DEBUG $setup_hack $skip_pkg_svc_hack );
use Carp qw(carp cluck confess);
use Scalar::Util qw( blessed );
-use Time::Local qw( timelocal timelocal_nocheck );
+use DateTime;
+use Time::Local qw( timelocal timelocal_nocheck ); # eventually replace with DateTime
use Tie::IxHash;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh dbdef );
@@ -1034,10 +1035,11 @@ sub delay_start_date {
my $self = shift;
my $delay = $self->delay_start or return '';
-
- my ($mday,$mon,$year) = (localtime(time))[3,4,5];
- timelocal(0,0,0,$mday,$mon,$year) + 86400 * $delay;
+ # avoid timelocal silliness
+ my $dt = DateTime->today(time_zone => 'local');
+ $dt->add(days => $delay);
+ $dt->epoch;
}
sub freqs_href {
-----------------------------------------------------------------------
Summary of changes:
FS/FS/part_pkg.pm | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
More information about the freeside-commits
mailing list