Prevent server time from going backwards in UpdateTime (#64)
This commit is contained in:
parent
e6a863de49
commit
48f05401ce
1 changed files with 4 additions and 2 deletions
|
|
@ -7,8 +7,10 @@ import (
|
||||||
|
|
||||||
// UpdateTime updates cached time.
|
// UpdateTime updates cached time.
|
||||||
func UpdateTime(newTime int64) {
|
func UpdateTime(newTime int64) {
|
||||||
pgp.latestServerTime = newTime
|
if newTime > pgp.latestServerTime {
|
||||||
pgp.latestClientTime = time.Now()
|
pgp.latestServerTime = newTime
|
||||||
|
pgp.latestClientTime = time.Now()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUnixTime gets latest cached time.
|
// GetUnixTime gets latest cached time.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue