From f8a765799e0fa5e38ac4b679c412c0bdb9029049 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Mon, 4 Feb 2019 19:17:58 +0100 Subject: [PATCH] Bug fix - getSplitDuration now returns the correct time --- lib/utils.js | 10 +++++----- web/http/scripts/query.js | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index d1cff89..a92be06 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -104,13 +104,13 @@ exports.getSplitDuration = function (duration) { let dur = duration; let retObj = {}; retObj.milliseconds = dur % 1000; - dur = Math.round(dur / 1000); + dur = Math.floor(dur / 1000); retObj.seconds = dur % 60; - dur = Math.round(dur / 60); + dur = Math.floor(dur / 60); retObj.minutes = dur % 60; - dur = Math.round(dur / 60); + dur = Math.floor(dur / 60); retObj.hours = dur % 24; - dur = Math.round(dur / 24); + dur = Math.floor(dur / 24); retObj.days = dur; return retObj; }; @@ -272,4 +272,4 @@ exports.logLevels = { 'warning': 3, 'warn': 3, 'error:': 4 -}; \ No newline at end of file +}; diff --git a/web/http/scripts/query.js b/web/http/scripts/query.js index ac1e987..b65e12d 100644 --- a/web/http/scripts/query.js +++ b/web/http/scripts/query.js @@ -13,13 +13,13 @@ function getSplitDuration (duration) { let dur = duration; let retObj = {}; retObj.milliseconds = dur % 1000; - dur = Math.round(dur / 1000); + dur = Math.floor(dur / 1000); retObj.seconds = dur % 60; - dur = Math.round(dur / 60); + dur = Math.floor(dur / 60); retObj.minutes = dur % 60; - dur = Math.round(dur / 60); + dur = Math.floor(dur / 60); retObj.hours = dur % 24; - dur = Math.round(dur / 24); + dur = Math.floor(dur / 24); retObj.days = dur; return retObj; }