MantisBT: master 85484ea4

Author Committer Branch Timestamp Parent
ethraza dregad master 2017-08-17 05:44:02 master 224e4fb7
Affected Issues  0022919: Time Tracking "auto count" is giving the wrong elapsed time
Changeset

Fix time tracking stopwatch lag

Prior to this, the stopwatch was lagging behind the real time and it was not
possible to manually edit the time field.

The lag was caused by the use of setTimeout to add to a counter each
second. Browsers put inactive tabs to sleep for a few seconds, causing
cumulative delays between each call to setTimeout.

I have changed setTimeout to setInterval to better express the intention
of calling a function in a loop and inside that function I have switched
from a simple add to a counter, to calculate the diff in seconds between
startTime and current time, using the moment.js library to help.

Fixes 0022919

Signed-off-by: Damien Regad <dregad@mantisbt.org>

mod - js/common.js Diff File