clock: Reduce a variable

This commit is contained in:
Hajime Hoshi 2017-08-06 00:29:06 +09:00
parent 1ea6bb2b6a
commit e98475cf9d

View File

@ -22,7 +22,6 @@ import (
var ( var (
m sync.Mutex m sync.Mutex
valid bool
tick int64 tick int64
lastTick int64 lastTick int64
frames int64 frames int64
@ -30,7 +29,6 @@ var (
func Inc() { func Inc() {
m.Lock() m.Lock()
valid = true
tick++ tick++
m.Unlock() m.Unlock()
} }
@ -42,7 +40,7 @@ func Frames(timeDuration time.Duration, fps int) (int, bool) {
count := 0 count := 0
sync := false sync := false
if valid && lastTick != tick { if tick > 0 && lastTick != tick {
if frames < tick { if frames < tick {
count = int(tick - frames) count = int(tick - frames)
} }