A GPS disciplined clock
Dependencies: net lpc1768 crypto clock web log
web-this/home/web-home-ajax.c
- Committer:
- andrewboyson
- Date:
- 2019-05-01
- Revision:
- 60:7cab896b0fd4
- Parent:
- 59:d2d25c2265f8
- Child:
- 87:5052e316994a
File content as of revision 60:7cab896b0fd4:
#include <stdint.h> #include <stdio.h> #include "http.h" #include "rtc.h" #include "clk.h" #include "clktime.h" #include "clkgov.h" #include "clkutc.h" #include "pps.h" #include "nmea.h" void WebHomeAjax() { HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL); clktime now = ClkNowTai(); clktime fraction = now & ((1UL << CLK_TIME_ONE_SECOND_SHIFT) - 1); clktime ms = (fraction * 1000) >> CLK_TIME_ONE_SECOND_SHIFT; HttpAddInt16AsHex(ms ); HttpAddChar('\n'); char byte = 0; if (RtcIsSet() ) byte |= 0x01; if (ClkTimeIsSet() ) byte |= 0x02; if (PpsIsStable() ) byte |= 0x04; if (NmeaTimeIsStable() ) byte |= 0x08; if (ClkGovRateIsSynced ) byte |= 0x10; if (ClkGovTimeIsSynced ) byte |= 0x20; if (ClkUtcGetNextLeapEnable() ) byte |= 0x40; if (ClkUtcGetNextLeapForward()) byte |= 0x80; HttpAddByteAsHex (byte ); HttpAddChar('\n'); HttpAddInt12AsHex(ClkUtcGetNextEpochMonth1970()); HttpAddChar('\n'); HttpAddInt16AsHex(ClkUtcGetEpochOffset() ); HttpAddChar('\n'); }