Cheers, I’ll take a look.
Unfortunately I can’t reproduce this issue. I’ve been playing around with timezones all over the place and everything is behaving as expected.
Are you still seeing the issue? If so, I’ll let you know what I’ll need from you in order to debug it.
Yes, still several hours off. Events are firing okay, it’s just reporting the time incorrectly.
I just discovered this as well. This patch fixes it, the code is doing an unnecessary duplicate application of the GMT offset.
--- wp-crontrol.php~ 2013-08-28 09:02:10.000000000 -0500
+++ wp-crontrol.php 2013-09-05 15:44:35.000000000 -0500
@@ -632,7 +632,7 @@
echo "<tr id=\"cron-{$id}\" class=\"{$class}\">";
echo "<td>".($event->hook=='crontrol_cron_job' ? __('<i>PHP Cron</i>', 'crontrol') : $event->hook)."</td>";
echo "<td>".($event->hook=='crontrol_cron_job' ? __('<i>PHP Code</i>', 'crontrol') : json_encode($event->args))."</td>";
- echo "<td>".get_date_from_gmt(date('Y-m-d H:i:s',$event->time),$time_format)." (".$this->time_since(time(), $event->time).")</td>";
+ echo "<td>".date('Y-m-d H:i:s',$event->time)." (".$this->time_since(time(), $event->time).")</td>";
echo "<td>".($event->schedule ? $this->interval($event->interval) : __('Non-repeating', 'crontrol'))."</td>";
echo "<td><a class='view' href='tools.php?page=crontrol_admin_manage_page&action=edit-cron&id={$event->hook}&sig={$event->sig}&next_run={$event->time}#crontrol_form'>Edit</a></td>";
echo "<td><a class='view' href='".wp_nonce_url("tools.php?page=crontrol_admin_manage_page&action=run-cron&id={$event->hook}&sig={$event->sig}", "run-cron_{$event->hook}_{$event->sig}")."'>Run Now</a></td>";
I’m not sure why that would fix the issue. Cron timestamps are supposed to be stored as GMT, so the offset needs to be applied in order to display the local time. That said, maybe that isn’t the case.
I’m going to test this some more this week and see what I can find. My current timezone is GMT+1 and I’m not seeing times that are off by an hour, so this is odd.
belg4mit: Is the local time that”s displayed below the table correct for you?
I get this issue.
Display is correct local, however when you edit it’s in GMT
funsail: Dates in WP-Cron are stored as GMT and converted to the local timezone when they’re displayed in the cron events table.
When you’re editing an event it’ll be displayed as GMT. I’ll add some text to the event editing form to clarify this.
I can reproduce this problem (I have version 1.2.2 of this plugin) and am on UTC-5 time.
Here is a simplified test case:
– under the table it says utc = 14:00:00 , local = 9:00:00
– edit a hook
– enter 15:00:00 under Next Run (UTC) since I desire to run this 1 hour from now
– press “Modify Cron Event” button
– the hook is changed in the table but the Next Run time says “10:00:00 (6 hours)”
The problem is that the Next Run time should say “10:00:00 (1 hour)” if it is intended to show local time in that column.
It is wrong because in following the prompt I entered the next run as 1 hour from now in UTC, but the program scheduled it for 6 hours from now even though it shows the time of day in the table as one hour from now.
Do you see that?