mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
use timezone when showing device time
This commit is contained in:
@@ -261,8 +261,8 @@
|
||||
<select class="form-control input-sm" style="display:none;" id="ssid" onchange="listBSSID();"></select>
|
||||
</span>
|
||||
<span class="col-xs-2">
|
||||
<button id="scanb" type="button" class="btn btn-primary btn-xs" style="display:none;"
|
||||
onclick="scanWifi()">Scan</button>
|
||||
<button id="scanb" type="button" class="btn btn-info btn-xs" style="display:none;"
|
||||
onclick="scanWifi()">Scan...</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row form-group" style="display:none" id="hidepasswd">
|
||||
@@ -287,7 +287,7 @@
|
||||
time (DST)</h6>
|
||||
<br>
|
||||
<div class="row form-group">
|
||||
<label class="col-xs-3">Device Time (UTC)</label>
|
||||
<label class="col-xs-3">Device Time</label>
|
||||
<span id="utc" class="col-xs-9 col-md-5">
|
||||
</span>
|
||||
</div>
|
||||
@@ -298,7 +298,7 @@
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<div class="col-xs-3">
|
||||
<button onclick="syncBrowserTime()" class="btn btn-link btn-sm">Sync Browser Time to Device</button><i
|
||||
<button onclick="syncBrowserTime()" class="btn btn-info btn-sm">Sync Browser Time to Device</button><i
|
||||
style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" aria-hidden="true"
|
||||
data-toggle="popover" data-trigger="hover" data-placement="right"
|
||||
data-content="Use your browser time. Useful when the system does not have an internet connection."></i>
|
||||
@@ -315,8 +315,8 @@
|
||||
<label class="radio-inline">
|
||||
<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>
|
||||
|
||||
<button onclick="forcentp()" id="forcentp" class="btn btn-info btn-sm">Sync Device with Internet
|
||||
Time</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
|
||||
@@ -51,8 +51,9 @@ function browserTime() {
|
||||
}
|
||||
|
||||
function deviceTime() {
|
||||
var c = new Date();
|
||||
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));
|
||||
var devTime = Math.floor(utcSeconds + ((c.getTimezoneOffset() * 60) * -1));
|
||||
t.setUTCSeconds(devTime);
|
||||
document.getElementById("utc").innerHTML = t.toUTCString().slice(0, -3);
|
||||
}
|
||||
@@ -308,7 +309,7 @@ function listSSID(obj) {
|
||||
opt.innerHTML = "BSSID: " + obj.list[i].bssid + ", Signal Strength: %" + percentage + ", Network: " + obj.list[i].ssid;
|
||||
select.appendChild(opt);
|
||||
}
|
||||
document.getElementById("scanb").innerHTML = "Re-Scan";
|
||||
document.getElementById("scanb").innerHTML = "Re-scan...";
|
||||
listBSSID();
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +226,7 @@ wss.on('connection', function connection(ws) {
|
||||
var res = {};
|
||||
res.command = "gettime";
|
||||
res.epoch = Math.floor((new Date).getTime() / 1000);
|
||||
//res.epoch = 1567107755;
|
||||
wss.broadcast(res);
|
||||
break;
|
||||
case "settime":
|
||||
|
||||
Reference in New Issue
Block a user