Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
Here's what I Use: Get the initial time from the server, and then use javascript to update it. <code> <?
///begin system time ///begin system time ///begin system time
$longOffset = shell_exec('ls -l /etc/localtime');
if (ereg("GMT+",$longOffset)) { $gmt = split("GMT",$longOffset); } else if (ereg("GMT-",$longOffset)) { $gmt = split("GMT",$longOffset); }
if (isset($gmt)){ $gmtNum = $gmt[1];
//fix for the jumpy time
$gmtVar = trim("Etc/GMT".$gmt[1]);
date_default_timezone_set($gmtVar);
//end timezone stuff } $timeHH = date("H"); $timeMM = date("i"); $timeSS = date("s"); $dateMM = date("m"); $dateDD = date("d"); $dateYYYY = date("Y");
?>
<script> var timePeriod = 1000;
function setPeriod(action) {
if (action == 'pause') {
timePeriod = 100000;
} else if (action == 'run') {
timePeriod = 1000;
//restart timers
updateTime(action);
}
}
function updateTime(action) {
clearTimeout(timer);
var timerText = "updateTime('" + action + "')";
var timer = setTimeout(timerText, timePeriod);
var curHour = parseFloat(document.forms['set_date_time'].hour.value);
var curMinute = parseFloat(document.forms['set_date_time'].minute.value);
var curSecond = parseFloat(document.forms['set_date_time'].second.value);
//CHECKING HOURS-MINUTES-SECONDS FOR ROLLOVERS
if (curSecond >= 59) {
if (curMinute >= 59) {
if (curHour >= 23) {
curHour = 00;
curMinute = 00;
curSecond = 00;
} else {
curHour++;
}
curMinute = 00;
} else {
curMinute++;
}
curSecond = 00;
} else {
curSecond++;
}
function addZeros(number){
if (number <= 9){
number = "0" + number;
}
return(number);
}
document.forms['set_date_time'].hour.value = addZeros(curHour);
document.forms['set_date_time'].minute.value = addZeros(curMinute);
document.forms['set_date_time'].second.value = addZeros(curSecond);
}
</script>
<div id="time">
</div>
<script language="JavaScript" type="text/javascript">updateTime('start');</script>
?> </code>
1 to 4 of 4