No need for extra servers, the OPs guys don't even need to know it's there. Take an extra performance hit that is equal to loading another image per page (yeah image requests, while probably served from CDN, also include an accurate Date response header as I checked), cached for 7 days (remove the cookie during periods of daylight saving times etc). Just have to make sure the server time is reasonably accurate. I'm sure a few seconds inaccuracy wouldn't matter.
window.getLocalUnixTime = ->
(new Date()).getTime()
window.loadTime = (callback) ->
if $.cookie("time-drift-delta")
callback(getLocalUnixTime() + parseInt($.cookie("time-drift-delta"), 10))
else
$.ajax window.location,
type: "HEAD"
success: (data, status, jqXHR) ->
datetime = new Date(jqXHR.getResponseHeader("Date"))
$.cookie("time-drift-delta", datetime.getTime() - getLocalUnixTime(), {expires: 7})
callback datetime
fail: ->
callback getLocalUnixTime()Yes you can come up with a hacky solution that works 80% of the time quickly, but if you want a 99% solution you need to put the work in to do it right.
It's not quite a "hacky" solution, I would guesstimate it would work 95% of the time rather than 80%, but even 80% is a great solution for the amount of work involved, the tradeoffs, and the fact that we're talking about a clock displayed on a website.
Or, you know, you could spend £15.000 taxpayers' money over 3 months for something I'm not even sure would be more flexible/maintainable/performant.
[0]: http://tools.ietf.org/html/rfc2616#section-14.18
[1]: E.g. URL's with random number in the query
Same thing with DST (I even mentioned it). Also once you have an accurate time, the javascript time object includes the DST logic itself I think. We're only dealing with an inaccurate local clock, we don't have to reimplement whatever ISO standard stands for Time. As soon as we have the delta between local time and server time, we're golden.
You obviously thought through the integration with monitoring, scaling and multiple redundancy systems so in the event of traffic spike or disaster it'll keep working without manual intervention.
That's not even touching the business logic complexity of issues like DST or leap seconds where you have to be able to arbitrarily change the clock forward or backward.