From ff4986098c9dcd03ee0362e18104f30a36064680 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 7 Sep 2015 22:00:03 -0500 Subject: [PATCH] lock: Fix lock timing if php and db use different time zones --- include/class.lock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/class.lock.php b/include/class.lock.php index 1a758a468..d1c5bc365 100644 --- a/include/class.lock.php +++ b/include/class.lock.php @@ -63,12 +63,12 @@ class Lock extends VerySimpleModel { } //Get remaiming time before the lock expires function getTime() { - return $this->isExpired()?0:($this->getExpireTime()-time()); + return max(0, $this->getExpireTime() - Misc::dbtime()); } //Should we be doing realtime check here? (Ans: not really....expiretime is local & based on loadtime) function isExpired() { - return (time()>$this->getExpireTime()); + return (Misc::dbtime() > $this->getExpireTime()); } function getCode() { -- GitLab