From 8c2b073bf9e5271f0b21204a47feb3ba8366812d Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 27 Dec 2021 17:18:27 +0000 Subject: [PATCH] This might fix issues where mysql isn't using UTC There appears to be an issue when UTC isn't the native time for the MySQL server so instead of using NOW() which is the servers date/time use utc_timestamp instead. this means all interfaces MUST set time stamps as UTC. --- application/models/Cat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/Cat.php b/application/models/Cat.php index 2f92b788..6a909ba5 100644 --- a/application/models/Cat.php +++ b/application/models/Cat.php @@ -85,7 +85,7 @@ } function recent_status() { - $this->db->where("timestamp > date_sub(now(), interval 15 minute)", NULL, FALSE); + $this->db->where("timestamp > date_sub(UTC_TIMESTAMP(), interval 15 minute)", NULL, FALSE); $query = $this->db->get('cat'); return $query;