function checkTime(i,filler) {
if (i <10) {
return filler+i.toString();
} else {
return i.toString();
}
}
function tickClock() {
d=new Date()
space=d.getTime().toString()
document.getElementById("clock-mega").innerHTML=space.slice(0,4);
document.getElementById("clock-lakh").innerHTML=space.slice(4,5);
document.getElementById("clock-hundred").innerHTML=space.slice(5,8);
document.getElementById("clock-sec").innerHTML=space.slice(8,10);
document.getElementById("clock-min").innerHTML=checkTime(d.getHours(),' ')+":"+checkTime(d.getMinutes(),'0')+":";
document.getElementById("clock-earthsec").innerHTML=checkTime(d.getSeconds(),'0');
var t = setTimeout(function(){tickClock()},500);
}