JRS: In article <10*************************@dcsi.net>, dated Sun, 10
Oct 2004 09:05:03, seen in news:comp.lang.javascript, Dennis M. Marks
<de******@dcsi.net> posted :
Is there a routine anywhere, not necessarily javascript, that can be
used to directly access a time server and display time, using
parameters to adjust for time zone, on a web site without going through
a third-party site?
Yes, site
www.heavens-above.com uses one, IIRC. Surely there are other
sites showing the capability.
It is sufficient to take code to access UTC/GMT from a server, and to
apply to its result the algorithms on my site, translated into language-
of-choice. The algorithms can be re-invented; and may be in the
libraries of some languages. Do not, however, trust any code written in
countries with a historical tradition of non-compliance with accepted
standards; if they can get it wrong, they will.
Allowing for time zone is trivial; one merely uses
setUTCHours(getUTCHours() + N) . Allowing for summer time transitions
given by reasonable rules is not too difficult. Allowing for the
decisions of politicians on time changes would require continuing
effort.
I don't know ASP, PHP, etc. - others here do - but ISTM that you could
use such technologies to deliver web-server time (which *should* be
time-server synchronised) with the page, which could determine the local
clock error, and then use my code, or similar, to display corrected
local time. Let the page self-refresh at intervals, to take out local
clock drift.
You don't say how the time zone required is to be determined; author's
choice, reader's choice, reader's location, ?.
One could use the time server to determine the current error of the
user's local GMT, which will (if the user is correctly configured) be
the same as the current error of the user's local local time (except
briefly at the summer/winter transitions), and can be used to correct
the latter for display.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.