From 81a24e4523784786dcc45abcf7a48c1e563ab2d1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 23 Mar 2016 22:05:02 +0100 Subject: moved javascript variables to own namepsace diff --git a/www/js/clock.js b/www/js/clock.js index a2b0628..673374e 100644 --- a/www/js/clock.js +++ b/www/js/clock.js @@ -21,6 +21,8 @@ 'use strict'; +var RHRD = RHRD || {}; + function Clock() { this.draw_callbacks = $.Callbacks('unique'); diff --git a/www/js/utils.js b/www/js/utils.js index 1c5727a..3af67ff 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -21,6 +21,8 @@ 'use strict'; +var RHRD = RHRD || {}; + Number.prototype.pad = function(size) { var s = String(this); while (s.length < (size || 2)) {s = "0" + s;} @@ -55,6 +57,19 @@ function format_datetime(d) { return datetimestr; } +function msToTimeString(time) { + if(time == '-') return time; + + var h = Number(Math.floor(time / 3600000)); + time %= 3600000; + var m = Number(Math.floor(time / 60000)); + time %= 60000; + var s = Number(Math.floor(time / 1000)); + var hs = Number(Math.floor((time % 1000)/100)); + + return h + ':' + m.pad(2) + ':' + s.pad(2) + '.' + hs; +} + function get_rd_week(msEpoch) { // // This computes the current Rivendell Week based on the number -- cgit v0.10.2