"Ivan" <de******@flyAWAY-SPAM.srk.fer.hr> schreef in bericht
news:sl*********************@fly.srk.fer.hr...
Hi,
let's say that my server time is for some reason incorrect! Is there a php
function that would automaticly correct that time (give or take a few
minutes, hours, days...) so date() function would return real
time/date!!
Thanks,
Ivan
--
EOF
As alternative you can play some with atomic times obtained from
timeservers:
The script below displays the 'real' time obtained from a timeserver and the
servertime on the providers server....
<?php
$server = "time.nist.gov";
$fp = fsockopen($server, 37);
$time = fread($fp, 4);
fclose($fp);
echo "Timestamp timeserver: ".hexdec(bin2hex($time))."<BR><BR>";
echo "Local timestamp on server provider: ".(time() +
2208988800)."<BR><BR>";
echo "Atomic time: ".strftime("%c", hexdec(bin2hex($time)) -
2208988800)."<BR><BR>";
echo "Local time on server provider: ".strftime("%c", time())."<BR><BR>";
?>
Marcel