Revision fe814d92
Added by Stephen Jones over 7 years ago
src/usr/local/www/widgets/widgets/ntp_status.widget.php | ||
---|---|---|
198 | 198 |
<script type="text/javascript"> |
199 | 199 |
//<![CDATA[ |
200 | 200 |
// Have to convet the date to UTC time to match the PHP clock not the local client clock. |
201 |
function convertDateToUTC(date) { |
|
202 |
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()); |
|
201 |
function convertDateToUTC(date,offset) { |
|
202 |
hours_offset = offset/3600; |
|
203 |
d = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours() + hours_offset, date.getUTCMinutes(), date.getUTCSeconds()) |
|
204 |
return d; |
|
203 | 205 |
} |
204 | 206 |
|
205 |
var ntp_d = convertDateToUTC(new Date('<?=date_format(date_create(), 'c')?>')); |
|
207 |
var ntp_d = convertDateToUTC(new Date('<?=date_format(date_create(), 'c')?>'), '<?=date('Z')?>');
|
|
206 | 208 |
var tz = '<?=date('T');?>'; |
207 |
|
|
208 | 209 |
setInterval(function() { |
209 | 210 |
ntp_d.setSeconds(ntp_d.getSeconds() + 1); |
210 | 211 |
var thisSecond = ntp_d.getSeconds(); |
... | ... | |
263 | 264 |
|
264 | 265 |
//]]> |
265 | 266 |
</script> |
266 |
<?php endif; ?> |
|
267 |
<?php endif; ?> |
Also available in: Unified diff
Fixed #7714 Edited it to show correct timezone