summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()] + ', ';