stopwatch: Ensure seconds counter is in sync with subseconds (fix #341)

pull/344/head
Gordon Williams 2020-04-23 10:53:09 +01:00
parent a389ed5dbe
commit 80ff424ac9
3 changed files with 4 additions and 2 deletions

View File

@ -452,7 +452,7 @@
{ "id": "swatch",
"name": "Stopwatch",
"icon": "stopwatch.png",
"version":"0.06",
"version":"0.07",
"interface": "interface.html",
"description": "Simple stopwatch with Lap Time logging to a JSON file",
"tags": "health",

View File

@ -6,3 +6,4 @@
0.04: Changed save file filename, add interface.html to allow laps to be loaded
0.05: Added widgets
0.06: Added total running time, moved lap time to smaller display, total run time now appends as first entry in array, saving now saves last lap as well
0.07: Ensure seconds counter is in sync with subseconds (fix #341)

View File

@ -94,7 +94,8 @@ setWatch(function() { // Start/stop
displayInterval = setInterval(function() {
var last = tCurrent;
if (started) tCurrent = Date.now();
if (Math.floor(last/1000)!=Math.floor(tCurrent/1000))
if (Math.floor((last-tStart)/1000)!=Math.floor((tCurrent-tStart)/1000) ||
Math.floor((last-tTotal)/1000)!=Math.floor((tCurrent-tTotal)/1000))
drawsecs();
else
drawms();