From 2a23cea5d24fab482668e737e7712104e4856840 Mon Sep 17 00:00:00 2001 From: Christian Berger Date: Wed, 5 Sep 2018 16:29:55 +0200 Subject: [PATCH] * Displaying timestamps in UTC Signed-off-by: Christian Berger --- README.md | 2 +- webapp/js/main.js | 32 ++++++++++++++++---------------- webapp/views/main.hbs | 6 +++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 86d6589..9b8aac5 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ OpenDLV Standard Message Set that are exchanged in a running OpenDLV.io session (running at 111 in the example), simply run it as follows: ``` -docker run --rm --init --net=host --name=opendlv-vehicle-view -v ~/recordings:/opt/vehicle-view/recordings -v /var/run/docker.sock:/var/run/docker.sock -p 8081:8081 chalmersrevere/opendlv-vehicle-view-multi:v0.0.36 +docker run --rm --init --net=host --name=opendlv-vehicle-view -v ~/recordings:/opt/vehicle-view/recordings -v /var/run/docker.sock:/var/run/docker.sock -p 8081:8081 chalmersrevere/opendlv-vehicle-view-multi:v0.0.37 ``` Now, simply point your web-browser to the IP address and port 8081 where you diff --git a/webapp/js/main.js b/webapp/js/main.js index 39548c8..ab01beb 100644 --- a/webapp/js/main.js +++ b/webapp/js/main.js @@ -135,14 +135,14 @@ function processEnvelope(incomingData) { var currentTimeStamp = data.sampleTimeStamp.seconds * 1000 * 1000 + data.sampleTimeStamp.microseconds; var date = new Date(currentTimeStamp/1000); - var year = date.getFullYear(); - var month = "0" + (date.getMonth()+1); - var day = "0" + date.getDate(); - var hours = date.getHours(); - var minutes = "0" + date.getMinutes(); - var seconds = "0" + date.getSeconds(); - - var formattedTime = year + '-' + month.substr(-2) + '-' + day.substr(-2) + ' ' + hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + var year = date.getUTCFullYear(); + var month = "0" + (date.getUTCMonth()+1); + var day = "0" + date.getUTCDate(); + var hours = date.getUTCHours(); + var minutes = "0" + date.getUTCMinutes(); + var seconds = "0" + date.getUTCSeconds(); + + var formattedTime = year + '-' + month.substr(-2) + '-' + day.substr(-2) + ' ' + hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2) + " (UTC)"; $("#containerTimeStamp").html(formattedTime); $("#containerTimeStampUnix").html(Math.floor(currentTimeStamp/1000) + " ms"); @@ -757,14 +757,14 @@ function setupUI() { //////////////////////////////////////////////////////////////////////////// function clock() { var date = new Date(new Date().getTime()); - var year = date.getFullYear(); - var month = "0" + (date.getMonth()+1); - var day = "0" + date.getDate(); - var hours = date.getHours(); - var minutes = "0" + date.getMinutes(); - var seconds = "0" + date.getSeconds(); - - var formattedTime = year + '-' + month.substr(-2) + '-' + day.substr(-2) + ' ' + hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + var year = date.getUTCFullYear(); + var month = "0" + (date.getUTCMonth()+1); + var day = "0" + date.getUTCDate(); + var hours = date.getUTCHours(); + var minutes = "0" + date.getUTCMinutes(); + var seconds = "0" + date.getUTCSeconds(); + + var formattedTime = year + '-' + month.substr(-2) + '-' + day.substr(-2) + ' ' + hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2) + " (UTC)"; $('#currentTime').text(formattedTime); window.setTimeout(clock, 500); diff --git a/webapp/views/main.hbs b/webapp/views/main.hbs index ccd2684..03ccbdd 100644 --- a/webapp/views/main.hbs +++ b/webapp/views/main.hbs @@ -271,9 +271,9 @@ {{/if}}
-
-
-
-
+
-
+
+