summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-06-25 11:21:33 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-06-25 11:21:33 (GMT)
commit03af1fed48370ddc4772709207f064c16191f5c1 (patch)
tree8cf9c986b48ce652326a92a9d5f2ab29034545fd
parentadd9b76db60093be8d680e28ca190fba479179fb (diff)
add clock.now()
-rw-r--r--www/js/clock.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/www/js/clock.js b/www/js/clock.js
index 3562b1e..458d1c7 100644
--- a/www/js/clock.js
+++ b/www/js/clock.js
@@ -32,8 +32,16 @@ function Clock() {
this.clock_rtt = 0;
this.state = 'NEW';
+ this.getRDTimeMS = function() {
+ return (+new Date()) + (this.last_message.tz_offset * 1000) + this.clock_offset;
+ }
+
+ this.now = function() {
+ return new Date(this.getRDTimeMS());
+ }
+
this.redraw = function() {
- var rdtime_ms = (+new Date()) + (this.last_message.tz_offset * 1000) + this.clock_offset;
+ var rdtime_ms = this.getRDTimeMS();
var rdtime = new Date(rdtime_ms);
var date_str = weekday_short[rdtime.getUTCDay()] + ', ';