Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22209

Re: OT: Displaying current time on a website

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: OT: Displaying current time on a website
Date 2013-11-28 23:09 +0100
Organization albasani.net
Message-ID <l78evn$7jc$1@news.albasani.net> (permalink)
References (1 earlier) <l70tc3$i40$1@dont-email.me> <l736ib$pgs$1@dont-email.me> <l738t2$738$1@dont-email.me> <52964acb$0$6635$9b4e6d93@newsspool2.arcor-online.net> <l75ncg$qc2$1@dont-email.me>

Show all headers | View raw


On 2013-11-27 22:15, Rhino wrote:
> On 2013-11-27 2:41 PM, Christoph Michael Becker wrote:
>> In your case I would emit the current time with SSI, and update the time
>> with browser side scripting -- if that is disabled or not available at
>> all, the visitor sees the time of the request, at least.  However, both
>> times may be considerably different due to timezone differences.
>>
> Interesting idea. How would I get the time from SSI but update it every 
> second via my HTML? I've got the SSI part already but I'm at a loss how 
> to update that time  on an ongoing basis.

I'd actually like to see an implementation of that. Counting up seconds
may seem trivial at a first glance, but how would you go about writing a
clock display (with second precision) that is

a) as accurate as possible (relative to the local time on the client)
b) as "smooth" as possible (does not increment the seconds display by
more than 1, if it can be avoided)
c) can handle the client being busy for extended periods (caused by
things like complex calculations, synchronous HTTP requests, high CPU
load, etc)
d) doesn't tax the client by using very short timeouts or intervals

I've got some ideas about how to implement it, but I'm curious about
what solutions other people might come up with.

- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: OT: Displaying current time on a website Rhino <no_offline_contact_please@example.com> - 2013-11-27 16:15 -0500
  Re: OT: Displaying current time on a website Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-28 01:11 +0000
    Re: OT: Displaying current time on a website "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-11-28 11:20 +0200
      Re: OT: Displaying current time on a website Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-29 00:12 +0000
        Re: OT: Displaying current time on a website Andrew Poulos <ap_prog@hotmail.com> - 2013-11-29 13:51 +1100
        Re: OT: Displaying current time on a website Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-29 10:58 +0100
    Re: OT: Displaying current time on a website Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-11-29 21:30 +0000
  Re: OT: Displaying current time on a website Stefan Weiss <krewecherl@gmail.com> - 2013-11-28 23:09 +0100
    Re: OT: Displaying current time on a website tony@mountifield.org (Tony Mountifield) - 2013-11-28 23:24 +0000
      Re: OT: Displaying current time on a website tony@mountifield.org (Tony Mountifield) - 2013-11-29 13:12 +0000
        Re: OT: Displaying current time on a website Stefan Weiss <krewecherl@gmail.com> - 2013-11-29 14:39 +0100
        Re: OT: Displaying current time on a website Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-11-30 20:35 +0000
          Re: OT: Displaying current time on a website "Evertjan." <exjxw.hannivoort@interxnl.net> - 2013-12-01 07:57 +0000

csiph-web