Bug 65840 - Allow day offsets

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@817 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-06-28 12:51:15 +00:00
parent 73559bafe4
commit 2527692304
1 changed files with 7 additions and 2 deletions

View File

@ -441,7 +441,8 @@ sub today {
}
sub today_dash {
my ($dom, $mon, $year) = (localtime(time))[3, 4, 5];
my ($shift) = @_;
my ($dom, $mon, $year) = (localtime(time+$shift*86400))[3, 4, 5];
return sprintf "%04d-%02d-%02d", 1900 + $year, ++$mon, $dom;
}
@ -471,7 +472,11 @@ sub CollectSeriesData {
# (days_since_epoch + series_id) % frequency = 0. So they'll run every
# <frequency> days, but the start date depends on the series_id.
my $days_since_epoch = int(time() / (60 * 60 * 24));
my $today = $ARGV[0] || today_dash();
my $today = $ARGV[0];
if ($today !~ /^\d{4,}-\d{2}-\d{2}$/so)
{
$today = today_dash($today =~ /^(-?\d+)$/ ? $1 : 0);
}
# We save a copy of the main $dbh and then switch to the shadow and get
# that one too. Remember, these may be the same.