Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clock] Fix incorrect delta calculation #5286

Merged
merged 2 commits into from
Dec 14, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed delta comparison
  • Loading branch information
ireneusz-ptak committed Dec 14, 2019
commit 84b1c35a90378fe8829dd612efa7bcba305cb2b9
6 changes: 3 additions & 3 deletions lib/client/clock-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ client.render = function render (xhr) {
let delta;

xhr.forEach(element => {
if (element.sgv && !rec && !delta) {
if (element.sgv && !rec) {
rec = element;
}
else if (element.sgv && rec && !delta) {
delta = ((rec.sgv - element.sgv)/((rec.date - element.date)/(5*60*1000))).toFixed(0);
else if (element.sgv && rec && delta==null) {
delta = (rec.sgv - element.sgv)/((rec.date - element.date)/(5*60*1000));
}
});

Expand Down