From f04f94b31b39d3c93ab8723dc2061b04f9a28863 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 18 Apr 2017 09:58:44 -0400 Subject: Bug 1347175 - cron: Invalid local time for date in time zone: America/Los_Angeles --- extensions/RequestNagger/bin/send-request-nags.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'extensions/RequestNagger/bin') diff --git a/extensions/RequestNagger/bin/send-request-nags.pl b/extensions/RequestNagger/bin/send-request-nags.pl index d9da4f04b..f823fc197 100755 --- a/extensions/RequestNagger/bin/send-request-nags.pl +++ b/extensions/RequestNagger/bin/send-request-nags.pl @@ -7,6 +7,7 @@ # This Source Code Form is "Incompatible With Secondary Licenses", as # defined by the Mozilla Public License, v. 2.0. +use 5.10.1; use strict; use warnings; @@ -42,10 +43,9 @@ if (my $filename = shift @ARGV) { exit; } -my $dbh = Bugzilla->dbh; -my $date = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); -my $now = datetime_from($date)->truncate( to => 'day' ); -$date = format_time($date, '%a, %d %b %Y %T %z', 'UTC'); +my $dbh = Bugzilla->dbh; +my $db_date = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); +my $date = format_time($db_date, '%a, %d %b %Y %T %z', 'UTC'); # delete expired defers $dbh->do("DELETE FROM nag_defer WHERE defer_until <= CURRENT_DATE()"); @@ -156,6 +156,7 @@ sub send_nags { sub _include_request { my ($request, $report) = @_; + state $now = datetime_from($db_date, 'UTC')->truncate( to => 'day' ); my $recipient = Bugzilla::User->new({ id => $request->{recipient_id}, cache => 1 }); @@ -180,7 +181,7 @@ sub _include_request { } # exclude weekends and re-check nag-interval - my $date = datetime_from($request->{modification_date}); + my $date = datetime_from($request->{modification_date}, 'UTC'); my $hours = 0; $hours += 24 - $date->hour if $date->day_of_week <= 5; $date->add( days => 1 )->truncate( to => 'day' ); -- cgit v1.2.3-24-g4f1b