cmd/syncthing: Skip a calculation if timediff is zero (fixes #2854)

This commit is contained in:
Audrius Butkevicius 2016-04-05 06:12:17 +01:00 committed by Jakob Borg
parent 1934b3a5b6
commit b678b4e048
1 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,10 @@ func trackCPUUsage() {
curTime := time.Now().UnixNano()
timeDiff := curTime - prevTime
// This is sometimes 0, no clue why.
if timeDiff == 0 {
continue
}
curUsage := ktime.Nanoseconds() + utime.Nanoseconds()
usageDiff := curUsage - prevUsage
cpuUsageLock.Lock()