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-html.c
- Revision:
- 30:6a08abbe6301
- Parent:
- 29:4d649264d6b6
- Child:
- 31:b5ca802195a7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/clock/http-clock-html.c Thu Jan 17 13:07:53 2019 +0000
@@ -0,0 +1,74 @@
+#include <time.h>
+
+#include "http.h"
+#include "page.h"
+#include "page-derived.h"
+#include "http-server.h"
+#include "clk.h"
+#include "rtc.h"
+#include "clkutc.h"
+#include "clkgov.h"
+#include "scan.h"
+
+void HttpClockHtml()
+{
+ HttpOk("text/html; charset=UTF-8", "no-cache", NULL, NULL);
+ PageAddHeader(PageSite, "Clock", "settings.css", "clock.js");
+ PageAddNav(CLOCK_PAGE);
+ PageAddH1(PageSite, "Clock");
+
+ PageAddH2("Status");
+ PageAddAjaxToggle(10.0, "RTC is set" , "ajax-rtc-set" , "");
+ PageAddAjaxToggle(10.0, "Clock is set" , "ajax-clock-set" , "");
+ PageAddAjaxToggle(10.0, "External source is ok", "ajax-source-ok" , "");
+ PageAddAjaxToggle(10.0, "Rate synchronised" , "ajax-rate-locked", "");
+ PageAddAjaxToggle(10.0, "Time synchronised" , "ajax-time-locked", "");
+
+ PageAddH2("Server UTC time");
+ HttpAddText("<div id='date-utc'></div>\r\n");
+
+ PageAddH2("Server local time");
+ HttpAddText("<div id='date-pc'></div>\r\n");
+
+ PageAddH2("Server - PC (ms)");
+ HttpAddText("<div id='date-diff'></div>\r\n");
+
+ PageAddH2("UTC");
+ PageAddAjaxToggle(16.0, "Enable epoch change" , "ajax-leap-enable" , "chg-clock-leap-enable" );
+ PageAddAjaxToggle(16.0, "Direction of next epoch" , "ajax-leap-forward" , "chg-clock-leap-forward");
+ PageAddAjaxHex (12.0, "Year next epoch starts" , 5.2 , "ajax-leap-year" , "set-clock-leap-year" );
+ PageAddAjaxHex (12.0, "Month next epoch starts" , 5.2 , "ajax-leap-month" , "set-clock-leap-month" );
+ PageAddAjaxHex (12.0, "Current era offset" , 5.2 , "ajax-leap-count" , "set-clock-leap-count" );
+
+ HttpAddText("<div><button type='button' onclick='DisplayLeap()'>Display Leap</button></div>\r\n");
+
+ HttpAddText("<div>The leap seconds list is available from <a href='https://www.ietf.org/timezones/data/leap-seconds.list' target='_blank'>ietf</a></div>\r\n");
+
+ PageAddH2("Governer");
+ PageAddIntInput ("/clock", 0, "Ppb", 12, "ppb", 5, ClkGovGetPpb() );
+ PageAddIntInput ("/clock", 0, "Ppb divisor", 12, "ppbdivisor", 5, ClkGovPpbDivisor );
+ PageAddIntInput ("/clock", 0, "Ppb max change", 12, "ppbmaxchange", 5, ClkGovPpbChangeMax );
+ PageAddIntInput ("/clock", 0, "Ppb synced limit", 12, "syncedlimitppb", 5, ClkGovSyncedLimitPpb );
+ PageAddIntInput ("/clock", 0, "Ppb synced hysteresis", 12, "syncedhysppb", 5, ClkGovSyncedHysterisPpb );
+
+ PageAddIntInput ("/clock", 0, "Offset divisor", 12, "slewdivisor", 5, ClkGovSlewDivisor );
+ PageAddIntInput ("/clock", 0, "Offset max (ms)", 12, "slewmax", 5, ClkGovSlewMaxMs );
+ PageAddIntInput ("/clock", 0, "Offset synced limit (ms)",12, "syncedlimitns", 5, ClkGovSyncedLimitNs / 1000000 );
+ PageAddIntInput ("/clock", 0, "Offset synced hys (ms)", 12, "syncedhysns", 5, ClkGovSyncedHysterisNs / 1000000 );
+ PageAddIntInput ("/clock", 0, "Offset reset limit (s)", 12, "maxoffsetsecs", 5, ClkGovMaxOffsetSecs );
+
+ PageAddH2("Trace");
+ if (ClkGovTrace) PageAddCheckInput("/clock", "Trace gov", "clockgovtrace", "on");
+ else PageAddCheckInput("/clock", "Trace gov", "clockgovtrace", "off");
+
+ PageAddH2("Scan times");
+ PageAddLabelledInt("Program cycles avg", 17, ScanAverage);
+ PageAddLabelledInt("Program cycles max", 17, ScanMaximum);
+ PageAddLabelledInt("Program cycles min", 17, ScanMinimum);
+
+ PageAddH2("Ajax");
+ HttpAddText("<code id='ajax-headers'></code>\r\n");
+ HttpAddText("<code id='ajax-response'></code>\r\n");
+
+ PageAddEnd();
+}