summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/clock.js2
-rw-r--r--www/js/utils.js15
2 files changed, 17 insertions, 0 deletions
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