View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0022919||mantisbt||time tracking||public||2017-05-23 15:07||2017-09-03 18:41|
|Target Version||2.6.0||Fixed in Version||2.6.0|
|Summary||0022919: Time Tracking "auto count" is giving the wrong elapsed time|
After one month using the Time Tracking feature to track the time I spent working on each project I started to fell something was wrong with the time I was spending working. Today I finally noted down the time to verify the counter and find it was completely wrong.
What I found is that the elapsed time is always about 50% the time I really took working.
I don't know what math the counter is doing, but I noticed it is not really checking the time it started against the current time.
|Steps To Reproduce|
What I'm doing is starting the counter on the Mantis tab and go working in another tabs and programs, when I need to do something not related to this project, I go back to the Mantis tab and add the empty note with the elapsed time. Simple like that.
|Tags||No tags attached.|
Depending on browsers the results are strange, especially if the browser tab is not active / visible.
As I was imagining. The setTimeout is probably just starting at 0 and adding each second to it.
Just an idea.
Just sent a PR.
MantisBT: master 85484ea4
Committer: dregad Details Diff
|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.
Signed-off-by: Damien Regad <email@example.com>
|mod - js/common.js||Diff File|
|2017-05-23 15:07||ethraza||New Issue|
|2017-05-23 15:39||atrol||Status||new => confirmed|
|2017-05-23 15:39||atrol||Note Added: 0056952|
|2017-05-24 12:09||ethraza||Note Added: 0056955|
|2017-08-09 13:39||ethraza||Note Added: 0057414|
|2017-08-09 17:11||atrol||Assigned To||=> atrol|
|2017-08-09 17:11||atrol||Status||confirmed => assigned|
|2017-08-09 17:11||atrol||Assigned To||atrol => community|
|2017-08-17 05:59||dregad||Changeset attached||=> MantisBT master 85484ea4|
|2017-08-17 05:59||dregad||Assigned To||community => dregad|
|2017-08-17 05:59||dregad||Status||assigned => resolved|
|2017-08-17 05:59||dregad||Resolution||open => fixed|
|2017-08-17 05:59||dregad||Fixed in Version||=> 2.6.0|
|2017-08-17 06:04||dregad||Target Version||=> 2.6.0|
|2017-09-03 18:41||vboctor||Status||resolved => closed|