summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAudrius Butkevicius <audrius.butkevicius@gmail.com>2016-04-05 06:12:17 +0100
committerJakob Borg <jakob@nym.se>2016-04-13 11:52:12 +0200
commit94c6110f2e10ab8dbb0a416556701317ecd437cc (patch)
tree372439151f0ef6984a6ec4eb1e34e41de4528201
parent55e80c38837d1867e7f554345449becf2d7efca6 (diff)
cmd/syncthing: Skip a calculation if timediff is zero (fixes #2854)v0.12.22
-rw-r--r--cmd/syncthing/gui_windows.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/syncthing/gui_windows.go b/cmd/syncthing/gui_windows.go
index 3da56bc710..c4afeb1a1c 100644
--- a/cmd/syncthing/gui_windows.go
+++ b/cmd/syncthing/gui_windows.go
@@ -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()