mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
clock: Bug fix: Do not pacic even when the clock is reversed
It is theoreticaly possible to change the clock. Ebiten should not panic whatever the clock time is.
This commit is contained in:
parent
833e467fde
commit
c2bc6408a3
@ -62,6 +62,7 @@ func calcCountFromTPS(tps int64, now int64) int {
|
||||
|
||||
diff := now - lastSystemTime
|
||||
if diff < 0 {
|
||||
// It is theoretically possible to change the OS clock, so now can be older than lastSystemTime.
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -126,9 +127,6 @@ func Update(tps int) int {
|
||||
defer m.Unlock()
|
||||
|
||||
n := now()
|
||||
if n < previousNow {
|
||||
panic("clock: now() must be monotonic but returned older time than before: perhaps overflowing?")
|
||||
}
|
||||
|
||||
c := 0
|
||||
if tps == UncappedTPS {
|
||||
|
Loading…
Reference in New Issue
Block a user