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
clock/http-clock-html.c
- Committer:
- andrewboyson
- Date:
- 2019-02-12
- Revision:
- 42:95fe2146d486
- Parent:
- 31:b5ca802195a7
- Child:
- 43:85d94d8d026a
File content as of revision 42:95fe2146d486:
#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");
PageAddAjaxInput (12.0, "Year next epoch starts" , 5.2 , "ajax-leap-year" , "set-clock-leap-year" );
PageAddAjaxInput (12.0, "Month next epoch starts" , 5.2 , "ajax-leap-month" , "set-clock-leap-month" );
PageAddAjaxInput (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, ClkGovPpbSyncedLimit );
PageAddIntInput ("/clock", 0, "Ppb synced hysteresis", 12, "syncedhysppb", 5, ClkGovPpbSyncedHysteresis );
PageAddIntInput ("/clock", 0, "Offset divisor", 12, "slewdivisor", 5, ClkGovSlewDivisor );
PageAddIntInput ("/clock", 0, "Offset max (ms)", 12, "slewmax", 5, ClkGovSlewChangeMaxMs );
PageAddIntInput ("/clock", 0, "Offset synced limit (ms)",12, "syncedlimitns", 5, ClkGovSlewSyncedLimitNs / 1000000 );
PageAddIntInput ("/clock", 0, "Offset synced hys (ms)", 12, "syncedhysns", 5, ClkGovSlewSyncedHysteresisNs / 1000000 );
PageAddIntInput ("/clock", 0, "Offset reset limit (s)", 12, "maxoffsetsecs", 5, ClkGovSlewOffsetMaxSecs );
PageAddH2("Trace");
if (ClkGovTrace) PageAddCheckInput("/clock", "Trace gov on" , "clockgovtrace", "turn off");
else PageAddCheckInput("/clock", "Trace gov off", "clockgovtrace", "turn on" );
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();
}