diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-25 11:21:33 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-25 11:21:33 (GMT) |
commit | 03af1fed48370ddc4772709207f064c16191f5c1 (patch) | |
tree | 8cf9c986b48ce652326a92a9d5f2ab29034545fd /www/js | |
parent | add9b76db60093be8d680e28ca190fba479179fb (diff) |
add clock.now()
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/clock.js | 10 |
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()] + ', '; |