mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
add button to force fetch NTP time
This commit is contained in:
@@ -131,7 +131,7 @@
|
||||
<div>
|
||||
<br>
|
||||
<legend>Event Log</legend>
|
||||
<h6 class="text-muted">Dates shown in () represent elapsed time in seconds when NTP is disabled</h6>
|
||||
<h6 class="text-muted">Dates shown in () represent elapsed time in seconds when NTP Time is disabled</h6>
|
||||
<br>
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
@@ -282,11 +282,12 @@
|
||||
<div id="ntpcontent">
|
||||
<br>
|
||||
<legend>Time Settings</legend>
|
||||
<h6 class="text-muted">With NTP enabled, all times are adjusted to the local timezone and respect daylight saving
|
||||
<h6 class="text-muted">With Network Time Protocol (NTP) enabled, all times are adjusted to the local timezone and
|
||||
respect daylight saving
|
||||
time (DST)</h6>
|
||||
<br>
|
||||
<div class="row form-group">
|
||||
<label class="col-xs-3">Device Time</label>
|
||||
<label class="col-xs-3">Device Time (UTC)</label>
|
||||
<span id="utc" class="col-xs-9 col-md-5">
|
||||
</span>
|
||||
</div>
|
||||
@@ -310,10 +311,12 @@
|
||||
<div class="col-xs-9">
|
||||
<form>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="1" name="ntpenabled">Enabled</label>
|
||||
<input type="radio" value="1" onclick="handleNTPON();" name="ntpenabled">Enabled</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="0" name="ntpenabled" checked>Disabled</label>
|
||||
<input type="radio" value="0" onclick="handleNTPOFF();" name="ntpenabled" checked>Disabled</label>
|
||||
</form>
|
||||
<button onclick="forcentp()" id="forcentp" class="btn btn-primary btn-xs">Fetch internet time</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
@@ -327,7 +330,7 @@
|
||||
<br>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-xs-3">Refresh Time<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign"
|
||||
<label class="col-xs-3">Recalibrate Time<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign"
|
||||
aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right"
|
||||
data-content="Time in minutes between scheduled NTP refreshes"></i></label>
|
||||
<span class="col-xs-9 col-md-5">
|
||||
|
||||
@@ -51,7 +51,7 @@ function browserTime() {
|
||||
}
|
||||
|
||||
function deviceTime() {
|
||||
var t = new Date(0); // The 0 there is the key, which sets the date to the epoch,
|
||||
var t = new Date(0); // The 0 there is the key, which sets the date to the epoch
|
||||
var devTime = Math.floor(utcSeconds + ((t.getTimezoneOffset() * 60) * -1));
|
||||
t.setUTCSeconds(devTime);
|
||||
document.getElementById("utc").innerHTML = t.toUTCString().slice(0, -3);
|
||||
@@ -75,6 +75,9 @@ function listntp() {
|
||||
|
||||
if (config.ntp.enabled) {
|
||||
$("input[name=\"ntpenabled\"][value=\"1\"]").prop("checked", true);
|
||||
handleNTPON();
|
||||
} else {
|
||||
handleNTPOFF();
|
||||
}
|
||||
|
||||
browserTime();
|
||||
@@ -114,6 +117,11 @@ function saventp() {
|
||||
uncommited();
|
||||
}
|
||||
|
||||
function forcentp() {
|
||||
websock.send("{\"command\":\"forcentp\"}");
|
||||
}
|
||||
|
||||
|
||||
function savegeneral() {
|
||||
var a = document.getElementById("adminpwd").value;
|
||||
if (a === null || a === "") {
|
||||
@@ -238,6 +246,14 @@ function handleAP() {
|
||||
document.getElementById("inputtohide").style.display = "block";
|
||||
}
|
||||
|
||||
function handleNTPON() {
|
||||
document.getElementById("forcentp").style.display = "block";
|
||||
}
|
||||
|
||||
function handleNTPOFF() {
|
||||
document.getElementById("forcentp").style.display = "none";
|
||||
}
|
||||
|
||||
function listnetwork() {
|
||||
document.getElementById("inputtohide").value = config.network.ssid;
|
||||
document.getElementById("wifipass").value = config.network.password;
|
||||
|
||||
Reference in New Issue
Block a user