Skip to content
Snippets Groups Projects
Commit d1388ae6 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #2533 from greezybacon/issue/2343


lock: Fix lock timing if php and db use different time zones

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents ea5d3cce ff498609
Branches
Tags
No related merge requests found
...@@ -63,12 +63,12 @@ class Lock extends VerySimpleModel { ...@@ -63,12 +63,12 @@ class Lock extends VerySimpleModel {
} }
//Get remaiming time before the lock expires //Get remaiming time before the lock expires
function getTime() { 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) //Should we be doing realtime check here? (Ans: not really....expiretime is local & based on loadtime)
function isExpired() { function isExpired() {
return (time()>$this->getExpireTime()); return (Misc::dbtime() > $this->getExpireTime());
} }
function getCode() { function getCode() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment