TOP /PHP PCの時計を調べるU

<button onclick="window.open('pcclock2.php','pcclock','width=200,height=100')">
時計チェック</button>
WWWサーバの時計とPCの時計の差を計算します。
WWWサーバがPHPを許可していなければ使えません
WWWサーバの時計の正確さに依存します。
下記をコピーしてファイルの拡張子をphpとして使います。

pcclock2.php

<html><head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=Shift_JIS">
<TITLE>PCの時計を調べる</TITLE>
<style type=text/css><!--
BODY{ font-size: 10pt; }
--></style>
</head>
<BODY>
<P>
<center>
<script language="JavaScript"><!--
sd =<? echo date(" U "); ?>;
dd = Math.floor(new Date().getTime()/1000);
gap=dd-sd;
if(!gap){
document.write("あなたのPCの時計は正確です");
}else{
if(gap>0)
txt="進んでいます"
else if(gap<0)
txt="遅れています"
gap= Math.abs(gap);
d=Math.floor(gap/86400);
d=(d)?d+"日と":"";
h=Math.floor((gap%=86400)/3600);
h=(h)?h+"時間":"";
m=Math.floor((gap%=3600)/60);
m=(m)?m+"分":"";
s=(gap%=60)+"秒";
document.write("あなたのPCの時計は<br>"+d+h+m+s+txt);
}/*himajin.moo.jp*/
// --></script>
<p>
<button onclick="window.close()">closs</button>
</center>
</body></html>