S
Swifty
Source page: http://www.swiftys.org.uk/retire
At the bottom of the page, is:
var day = weekday();
setInterval('getCurrentTime()', 1000);
Which uses:
function weekday() {
var date = new Date();
var dd = date.getDay();
return dd;
getCurrentTime does this (amongst other things)
function getCurrentTime()
{
...
var newday = weekday();
if (newday !== day) window.location.reload();
}
The idea is to reload the page shortly after midnight. Last night, it
reloaded at 23:59:55 ...
I know this, because the page is created by a CGI script which writes
out the time that the page loaded, as part of the page.
I've checked that the API in the scripting language is accurate; it
matches the system clock to within 300mS at the very least (judged by
eye, comparing my code against the time in the Windows start bar.
So, how come the Javascript "jumped the gun" by at least 5 seconds in
determining the Day?
Presumably, Javascript is implemented differently in different
browsers; should I take this up with the authors of the browser that I
was using? (Opera; latest public release)
At the bottom of the page, is:
var day = weekday();
setInterval('getCurrentTime()', 1000);
Which uses:
function weekday() {
var date = new Date();
var dd = date.getDay();
return dd;
getCurrentTime does this (amongst other things)
function getCurrentTime()
{
...
var newday = weekday();
if (newday !== day) window.location.reload();
}
The idea is to reload the page shortly after midnight. Last night, it
reloaded at 23:59:55 ...
I know this, because the page is created by a CGI script which writes
out the time that the page loaded, as part of the page.
I've checked that the API in the scripting language is accurate; it
matches the system clock to within 300mS at the very least (judged by
eye, comparing my code against the time in the Windows start bar.
So, how come the Javascript "jumped the gun" by at least 5 seconds in
determining the Day?
Presumably, Javascript is implemented differently in different
browsers; should I take this up with the authors of the browser that I
was using? (Opera; latest public release)