SiT! Bugs - SiT!
View Issue Details
0000577SiT!schedulerpublic2009-03-18 18:172009-10-15 21:55
0000577: Scheduler not running when local time zone is different than server time zone.
When the local time is different to the server time zone the scheduer doesn't run as expected.

For example ...

If the local time is 7pm, and the server time in 12pm

auto.php runs ... set's the next run time (for inbound email) to be 7.01 pm.

on it's next run ...

it checks the next run time (7.01pm) against the server time (12.01pm) and doesn't do anything.

The script will eventually run correctly when the server time reaches 7.01pm.

(I presume if the time different is the other way around some scripts will run too often)

My local time zone is GMT+0 my hosted server is GMT-7. When the script runs it updates the next run time to be my local time + 1 minute, cron runs auto.php every minute but auto.php won't do anything because the next run time is 7 hours away.

I've tried changing the shell time zone with export TZ=GMT+0

I've tired changing the php time zone using putenv("TZ=EUROPE/DUBLIN");

Any other suggestions?

No tags attached.
related to 0000864confirmed  New config setting for 'Default User Timezone' 
Issue History
2009-03-18 18:17anonymousNew Issue
2009-08-15 13:31ivanNote Added: 0001543
2009-08-15 13:31ivanStatusnew => feedback
2009-08-15 13:33ivanRelationship addedrelated to 0000864
2009-08-20 12:04ivanNote Added: 0001795
2009-08-20 12:04ivanStatusfeedback => confirmed
2009-08-20 12:04ivanTarget Version => 3.50
2009-08-20 12:04ivanDescription Updatedbug_revision_view_page.php?rev_id=18#r18
2009-08-22 10:17ivanStatusconfirmed => assigned
2009-08-22 10:17ivanAssigned To => ivan
2009-09-09 18:15kieranNote Added: 0001918
2009-09-10 01:06ivanNote Added: 0001919
2009-09-10 13:18ivanNote Added: 0001920
2009-09-10 14:23ivanNote Added: 0001923
2009-09-10 20:05codemonkeyCheckin
2009-09-10 20:05codemonkeyNote Added: 0001924
2009-09-10 20:07ivanNote Added: 0001925
2009-09-10 20:07ivanStatusassigned => resolved
2009-09-10 20:07ivanResolutionopen => fixed
2009-09-10 20:07ivanFixed in Version => Current SVN
2009-09-12 12:06ivanFixed in VersionCurrent SVN => 3.50
2009-10-01 21:09ivanNote Added: 0002058
2009-10-03 11:42ivanNote Added: 0002059
2009-10-03 13:54kieranNote Added: 0002060
2009-10-04 14:23codemonkeyCheckin
2009-10-04 14:23codemonkeyNote Added: 0002063
2009-10-15 21:55ivanStatusresolved => closed

2009-08-15 13:31   
The sit timezone setting "System Time Zone" should be set to match your server timezone. Set the timezone in your user profile(s) to the 'local timezone'.

You should find this fixes the issues you're having.

We should add a setting for 'default user timezone' to make this easier in future.
2009-08-20 12:04   
Mikail on IRC had this same problem and I connected in to have a look. It does appear that there is an issue here, sorry that I dismissed it so quickly.
2009-09-09 18:15   
I might be going mad but I'm not sure if this is to do with timezones at all, I'm getting the same problem.

Diving into the code:

$sql = "SELECT * FROM `{$dbScheduler}` WHERE status = 'enabled' AND type = 'interval' ";
$sql .= "AND UNIX_TIMESTAMP(start) <= $now AND (UNIX_TIMESTAMP(end) >= $now OR UNIX_TIMESTAMP(end) = 0) ";
$sql .= "AND IF(UNIX_TIMESTAMP(lastran) > 0, UNIX_TIMESTAMP(lastran) + `interval` <= $now, UNIX_TIMESTAMP(NOW())) ";
$sql .= "AND laststarted <= lastran";

The last two lines of this query make it so I never get any results returned, removing them seems to return the right results.

Additionally, the query in schedule_action_done() doesn't seem to work for me, it never updates a task even though it completes. Running the SQL by hand doesn't either but the SQL looks fine.
2009-09-10 01:06   
Yeah your right not going mad. I fixed this dunno where the fix is thou right now.
2009-09-10 13:18   
This was fixed in [^]

Not sure how I get this into the 3.x branch now, help!
2009-09-10 14:23   
This rapidshare link contains a version of that has this patch [^]
2009-09-10 20:05   
This issue was mentioned in a commit by Ivan Lucas in commit 19e20c20709a54c4f436afd7308ebb89b1c7d584 [^]

Fix a timezone issue when marking scheduler actions as done, this should fix Mantis bug 577
2009-09-10 20:07   
Branch: refs/heads/sitracker3
Home: [^]

Commit: 23b79d5954df13bcb47916ea26b6ed52146afd25 [^]
Author: Ivan Lucas <>
Date: 2009-09-10 (Thu, 10 Sep 2009)

Changed paths:
 M scheduler.php

Log Message:
Added a legend to the Scheduler page, the colours have been confusing people for a while now

Commit: 19e20c20709a54c4f436afd7308ebb89b1c7d584 [^]
Author: Ivan Lucas <>
Date: 2009-09-10 (Thu, 10 Sep 2009)

Changed paths:
 M lib/

Log Message:
Fix a timezone issue when marking scheduler actions as done, this should fix Mantis bug 577
2009-10-01 21:09   
There do appear to be issues with this still, need to look into it before 3.50 is released.
2009-10-03 11:42   
I've spent some time trying to get this to fail and I can't. So I'm going to have to treat it fixed until somebody can give me some more info about any remaining issues.
2009-10-03 13:54   
According to the commits, nothing has been touched in schedule_action_done()? There's a bug in the code that wasn't updating any tasks for me.
2009-10-04 14:23   
This issue was mentioned in a commit by Ivan Lucas in commit acddd36eef1a16a6cd7bd788954538a83acd14af [^]

Fix bug 972 timezone issues. This may also affect some issues reported under bug 577