On my own computers this script hasn’t survived the start of Daylight
Saving Time: it’s off by one hour. However, on other computers it still works fine.
If you could check if this script gives the correct Beat time and
mail me if it doesn’t I’d be very happy.
The Internet Beat is a new measure of time, meant especially for the Internet. It divides the day into 1000 beats of 86.4 seconds each. It is written with an @ in front of it. The great advantage of it is that it offers a truly worldwide time, so that people in wildly different timezones can agree to mail each other "around @600".
Internet Beat has been invented by Swatch and has generally been received favourably by the Internet community.
I myself have helped writing the original JavaScript implementation for the Swatch site. In 1999 there came a complex query about date and time on a mailing list. I didn't really understand why the programmer wanted to measure intervals of 86.4 seconds, but I helped solve the problem and forgot all about it. More than a year later I found out what Internet Beats were supposed to do and I liked the idea. I also remembered the JavaScript problem.
The main problem is that, since Swatch's corporate headquarters are in Switzerland, @0 is defined as midnight in the Central European timezone (and @500 as noon in CET). I don't mind this as such, I myself live in the CET zone, but writing a script becomes more difficult because there's no certain way to transform a local time string to CET.
The current Internet Beat time is .
The simple script I wrote rests on two assumptions:
The script is very simple:
function getBeat() { var now = new Date(); var off = (now.getTimezoneOffset() + 60)*60; var theSeconds = (now.getHours() * 3600) + (now.getMinutes() * 60) + now.getSeconds() + off; var beat = Math.floor(theSeconds/86.4); if (beat > 1000) beat -= 1000; if (beat < 0) beat += 1000; return beat; }
First of all take the current date according to the computer the browser is on, in its local time zone
function getBeat() { var now = new Date();
Then take the TimezoneOffset, the difference between local time and GMT time, in minutes. Add 60 to this to get the CET time, always one hour in advance of GMT. Multiply by 60 to get the offset in seconds.
var off = (now.getTimezoneOffset() + 60)*60;
Now calculate the day time in seconds by taking the hours, multiplying them by 3600, then the minutes, multiplied by 60, the seconds and the calculated offset.
var theSeconds = (now.getHours() * 3600) + (now.getMinutes() * 60) + now.getSeconds() + off;
Divide this number by 86.4 and make it an integer to get the time in Internet Beats.
var beat = Math.floor(theSeconds/86.4);
A slight bug defeating rule: Netscape 3 and 4 on Mac give a wrong timezoneoffset so that the beat may be exactly 1000 too high or too low. If it's more than 1000, subtract 1000, if it's less than zero, add 1000.
if (beat > 1000) beat -= 1000; if (beat < 0) beat += 1000;
Finally return the Internet Beat to whichever function asked for it.
return beat; }