I have the code below, which displays a clock on a page, which serves to record factory intervals. It works perfectly, with the code below:
function moveRelogio(){
momentoAtual = new Date();
hora = momentoAtual.getHours();
if (hora < 10) {
hora = '0' + hora;
} else {
hora = hora + '';
}
minuto = momentoAtual.getMinutes();
if (minuto < 10) {
minuto = '0' + minuto;
} else {
minuto = minuto + '';
}
segundo = momentoAtual.getSeconds();
if (segundo < 10) {
segundo = '0' + segundo;
} else {
segundo = segundo + '';
}
horaImprimivel = hora + ":" + minuto + ":" + segundo
document.cadastro.hora_inicio.value = horaImprimivel;
setTimeout("moveRelogio()",1000);
}
Eventually the displayed time is not the same registered, because for registration the AD time is used. The user can not change it because PI is used without keyboard and mouse.
Is there any way to get the time from a server or the internet from an NTP?