Get time and start time aligned.

This commit is contained in:
mattbk 2023-09-05 15:41:56 -05:00
parent 2060df9691
commit a47451b541

View File

@ -61,11 +61,12 @@ const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html><head>
<title>ESP Input Form</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type='text/javascript'>
<script>
// Submit timestamps as unix seconds
var putDate = function(form) {
form.inputTimeUnix.value = Math.floor(Date.now() / 1000);
document.getElementById("js_start_time_unix").value = (Date.parse(js_start_time_unix_entry.value))/1000;
//offset_secs = new Date().getTimezoneOffset()*60;
document.getElementById("js_start_time_unix").value = ((Date.parse(js_start_time_unix_entry.value))/1000) - new Date().getTimezoneOffset()*60;
};
// Refresh page after submit so values are right https://stackoverflow.com/a/1860732/2152245
window.onload = function() {
@ -425,6 +426,7 @@ void setup() {
yourInputWPM = readFile(SPIFFS, "/inputWPM.txt").toInt();
yourInputMsg = readFile(SPIFFS, "/inputMsg.txt").toInt();
yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat();
yourInputStartTimeUnix = readFile(SPIFFS, "inputStartTimeUnix.txt").toInt();
// On restart, keep doing what you were doing before
yourInputMsg_old = yourInputMsg;