Buggy Date searching - GMT mishap?

Here’s a code core snippet and the results. Check out the resulting SQL query! I’m still digging to find the source of this problem. I’m not sure but I think this started after I upgraded from 3.0.6 to 3.0.8 as I’ve never seen my reminder script behave the way it has until after that point.

my $tickets = new RT::Tickets($RT::SystemUser);
my $timeDelta = new RT::Date($RT::SystemUser);
my $maxAge = 30;
$timeDelta->SetToNow();
print $timeDelta->ISO . “\n”;
$timeDelta->AddSeconds($maxAge * 60 * -1);
print $timeDelta->ISO . “\n”;
$tickets->LimitCreated(OPERATOR => ‘>’, VALUE => $timeDelta->ISO);
$tickets->DEBUG(1);

my $tix;
while (my $Ticket = $tickets->Next) {
print $Ticket->id . “\n”;
}

[pts/0:cvs] [/var/tmp] > date
Tue Jan 13 16:39:33 EST 2004

[pts/0:cvs] [/var/tmp] > sudo ./nag
2004-01-13 21:39:40
2004-01-13 21:09:40
RT::Tickets=HASH(0x8b653f0)->_GenericRestriction QualifiedField=main.Created
RT::Tickets=HASH(0x8b653f0)->_GenericRestriction QualifiedField=main.EffectiveId
RT::Tickets=HASH(0x8b653f0)->_GenericRestriction QualifiedField=main.Type
DBIx::SearchBuilder->DoSearch Query: SELECT main.* FROM Tickets main WHERE ((main.EffectiveId = main.id)) AND ((main.Type = ‘ticket’)) AND ( ( (main.Created > ‘2004-01-14 02:09’) ) )

-=| Ben

Indeed replacing Tickets_Overlay.pm with the 3.0.6 one corrects the problem.

From 3.0.8’s file:

} else {
$value = strftime(“%Y-%m-%d %H:%M”, gmtime($time));
$sb->_SQLLimit(

that should be localtime. It was in 3.0.6

-=| Ben