diff --git a/html/admin.html b/html/admin.html index 37d72f5..043ec44 100755 --- a/html/admin.html +++ b/html/admin.html @@ -588,29 +588,30 @@ window.onload = function() { document.getElementById("sys_UTC_time").value = response.system_utc_time; document.getElementById("RTC_utc_time").value = response.rtc_module_time; - // Get the time difference - const timeDiff = response.time_difference_seconds; - - // Reference to the alert container + // Compare RTC time with browser time (more reliable than system time) const alertContainer = document.getElementById("alert_container"); - - // Remove any previous alert alertContainer.innerHTML = ""; - // Add an alert based on time difference - if (typeof timeDiff === "number") { - if (timeDiff >= 0 && timeDiff <= 10) { + if (response.rtc_module_time) { + const rtcDate = new Date(response.rtc_module_time + ' UTC'); + const browserDate = new Date(); + const timeDiff = Math.abs(Math.round((browserDate - rtcDate) / 1000)); + + if (timeDiff <= 30) { alertContainer.innerHTML = `