Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Revision:
125:8c84daac38ab
Parent:
124:6e558721ec1c
Child:
134:3aa1bc602b19
--- a/udp/ntp/ntpserver.c	Fri Feb 22 08:41:47 2019 +0000
+++ b/udp/ntp/ntpserver.c	Fri Feb 22 11:26:55 2019 +0000
@@ -33,8 +33,8 @@
     if (!ClkTimeIsSet()           ) return 3; //Alarm condition; clock is not synchronised
     if (!ClkUtcGetNextLeapEnable()) return 0; //No warning
     
-    int64_t nowTime = ClkUtcFromTai(ClkNowTai());
-    int64_t liPriorNotice = LI_PRIOR_NOTICE_SECONDS << CLK_TIME_ONE_SECOND_SHIFT;
+    clktime nowTime = ClkUtcFromTai(ClkNowTai()); //Use the less costly time this scan
+    clktime liPriorNotice = LI_PRIOR_NOTICE_SECONDS << CLK_TIME_ONE_SECOND_SHIFT;
     
     if (nowTime > ClkUtcGetNextEpoch() - liPriorNotice)
     {
@@ -75,7 +75,7 @@
     }
     
     uint64_t refNtp    = getRefNtp();
-    uint64_t nowNtp    = NtpTimeStampFromClkTime(ClkTimeGet());
+    uint64_t nowNtp    = NtpTimeStampFromClkTime(ClkTimeGet()); //use the costly time at this instant
     int      stratum   = getStratum();
     char*    ident     = getIdent();
     int      li        = getLi();