User:Lieven Van Speybroeck/Other/Speelplaats

From XPUB & Lens-Based wiki

Speeltijd: A 12/7 Time System

This clock was developed as an alternative timesystem for the Speelplaats project at Werkplaats Typografie, Arnhem. Speeltime runs 12/7 faster than global time, resulting in 12 day weeks. Check out the Speelplaats time here

code (javascript)

<script language="javascript">
len=40;
tid = 0;
num=0;
speeltijd=((1000/12)*7)
clockA = new Array();
timeA = new Array();
formatA = new Array();
dd = new Date();
var d,x;
days = new Array("Firstday","Secondday","Thirdday","Fourthday","Fifthday","Sixthday","Seventhday","Eighthday","Ninthday","Tenthday","Eleventhday","Twelfthday");

function doDate(x)
{
  for (i=0;i<num;i++) {
    dt = new Date();
  
    if (timeA[i] != 0) {
      v1 = Math.round(( dt - timeA[i] )/speeltijd) ;
      if (formatA[i] ==1) {
        sec = v1%60;
		v1 = Math.floor(v1/60);
		min = v1 %60 ;
		v1 = Math.floor(v1/60);
		hour = v1 %24 ;
		day = Math.floor(v1/24)%12;
		if (sec < 10 ) sec = "0"+sec;
		if (min < 10 ) min = "0"+min;
		if (hour < 10 ) hour = "0"+hour;
		document.speelclock.speeldag.value = days[day];
		document.speelclock.speeltijd.value = hour+" : "+min+" : "+sec;
	  }
	}
  }
  tid=window.setTimeout("doDate()",speeltijd);
}

function start(d,x,format) {
  clockA[num] = x
  if (d == "now")
    timeA[num] = new Date();
  else
    timeA[num] = new Date(d);
  formatA[num] = format;
//window.alert(timeA[num]+":"+d);
  if (num == 0)  
    tid=window.setTimeout("doDate()",speeltijd);
  num++;
}

function CountupLong(t,format,len)
{
  start(t,document.forms["form"+num],format);
}

function Countup(t)
{
  CountupLong(t,1,100);
}
</script>