Admin Clock: RTC en evidence, ajout Browser time UTC, System time replie
- RTC time mis en avant (label bold, input large, bordure bleue) - Ajout champ Browser time (UTC) avec heure de l'appareil - System time replie dans un details/summary (non utilise) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -211,22 +211,33 @@
|
||||
<h3 class="mt-4">Clock</h3>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="sys_local_time" class="form-label">System time (local)</label>
|
||||
<input type="text" class="form-control" id="sys_local_time" disabled>
|
||||
<small class="text-muted">Horloge Linux du Raspberry Pi. Se synchronise via internet (NTP). Non utilisee par le capteur.</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="sys_UTC_time" class="form-label">System time (UTC)</label>
|
||||
<input type="text" class="form-control" id="sys_UTC_time" disabled>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="RTC_utc_time" class="form-label">RTC time (UTC)</label>
|
||||
<input type="text" class="form-control" id="RTC_utc_time" disabled>
|
||||
<label for="RTC_utc_time" class="form-label fw-bold fs-5">RTC time (UTC)</label>
|
||||
<input type="text" class="form-control form-control-lg border-primary" id="RTC_utc_time" disabled>
|
||||
<small class="text-muted">Module DS3231 avec pile de sauvegarde. Garde l'heure meme hors tension. Horloge de reference du capteur.</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="browser_utc_time" class="form-label">Browser time (UTC)</label>
|
||||
<input type="text" class="form-control" id="browser_utc_time" disabled>
|
||||
<small class="text-muted">Heure de votre appareil (PC/Mac/tablette). Reference pour verifier le RTC.</small>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<details class="mb-3">
|
||||
<summary class="text-muted" style="cursor:pointer;">System time (non utilise par le capteur)</summary>
|
||||
<div class="mt-2">
|
||||
<div class="mb-3">
|
||||
<label for="sys_local_time" class="form-label">System time (local)</label>
|
||||
<input type="text" class="form-control form-control-sm" id="sys_local_time" disabled>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="sys_UTC_time" class="form-label">System time (UTC)</label>
|
||||
<input type="text" class="form-control form-control-sm" id="sys_UTC_time" disabled>
|
||||
</div>
|
||||
<small class="text-muted">Horloge Linux du Raspberry Pi. Se synchronise via internet (NTP). Non utilisee par le capteur.</small>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
|
||||
<div id="alert_container"></div>
|
||||
|
||||
@@ -588,13 +599,22 @@ window.onload = function() {
|
||||
document.getElementById("sys_UTC_time").value = response.system_utc_time;
|
||||
document.getElementById("RTC_utc_time").value = response.rtc_module_time;
|
||||
|
||||
// Compare RTC time with browser time (more reliable than system time)
|
||||
// Display browser time in UTC
|
||||
const browserDate = new Date();
|
||||
const browserUTC = browserDate.getUTCFullYear() + '-' +
|
||||
String(browserDate.getUTCMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(browserDate.getUTCDate()).padStart(2, '0') + ' ' +
|
||||
String(browserDate.getUTCHours()).padStart(2, '0') + ':' +
|
||||
String(browserDate.getUTCMinutes()).padStart(2, '0') + ':' +
|
||||
String(browserDate.getUTCSeconds()).padStart(2, '0');
|
||||
document.getElementById("browser_utc_time").value = browserUTC;
|
||||
|
||||
// Compare RTC time with browser time
|
||||
const alertContainer = document.getElementById("alert_container");
|
||||
alertContainer.innerHTML = "";
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user