Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Diff: clock/http-clock-script.inc
- Revision:
- 96:eb2eb75bad0f
- Parent:
- 95:8c9dda8a0caf
diff -r 8c9dda8a0caf -r eb2eb75bad0f clock/http-clock-script.inc
--- a/clock/http-clock-script.inc Thu Apr 18 15:26:29 2019 +0000
+++ b/clock/http-clock-script.inc Fri Apr 19 14:40:58 2019 +0000
@@ -39,17 +39,10 @@
"\n"
"const DISPLAY_LEAP_MS = 10000;\n"
"\n"
-"function parseDate()\n"
-"{\n"
-" let iDateStart = Ajax.headers.toLowerCase().indexOf('date:');\n"
-" let iDateEnd = Ajax.headers.indexOf('\\r', iDateStart);\n"
-" let rtcDate = new Date(Ajax.headers.slice(iDateStart + 5, iDateEnd));\n"
-" rtc.ms = rtcDate.getTime();\n"
-"}\n"
-"\n"
"function parseLinesTime(text)\n"
"{\n"
" let lines = text.split('\\n');\n"
+" rtc.ms = Ajax.date.getTime();\n"
" rtc.ms += parseInt(lines[0], 16);\n"
" rtc.ms -= Ajax.ms;\n"
" diffMs = rtc.ms + Ajax.ms - Date.now();\n"
@@ -98,7 +91,6 @@
"function parse()\n"
"{\n"
" let topics = Ajax.response.split('\\f');\n"
-" parseDate();\n"
" parseLinesTime(topics[0]);\n"
" parseLinesGov (topics[1]);\n"
" parseLinesNtp (topics[2]);\n"
@@ -146,6 +138,7 @@
" \n"
" elem = Ajax.getElementOrNull('ajax-date-diff' ); if (elem) elem.textContent = diffMs;\n"
"}\n"
+"\n"
"function handleTick() //This typically called every 100ms\n"
"{\n"
" if (pseudoDisplay)\n"