You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main/core__sntp__client_8h_source.html
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -286,8 +286,8 @@
286
286
<divclass="ttc" id="agroup__sntp__callback__types_html_gade7b1a15684e1272ef7dbb9e4486c285"><divclass="ttname"><ahref="group__sntp__callback__types.html#gade7b1a15684e1272ef7dbb9e4486c285">SntpSetTime_t</a></div><divclass="ttdeci">void(* SntpSetTime_t)(const SntpServerInfo_t *pTimeServer, const SntpTimestamp_t *pServerTime, int64_t clockOffsetMs, SntpLeapSecondInfo_t leapSecondInfo)</div><divclass="ttdoc">Interface for user-defined function to update the system clock time so that it is synchronized the ti...</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:134</div></div>
287
287
<divclass="ttc" id="agroup__sntp__callback__types_html_gae382a67b0ffbb4721d8d599efe3020c4"><divclass="ttname"><ahref="group__sntp__callback__types.html#gae382a67b0ffbb4721d8d599efe3020c4">SntpValidateServerAuth_t</a></div><divclass="ttdeci">SntpStatus_t(* SntpValidateServerAuth_t)(SntpAuthContext_t *pContext, const SntpServerInfo_t *pTimeServer, const void *pResponseData, uint16_t responseSize)</div><divclass="ttdoc">Interface for user-defined function to authenticate server by validating the authentication code pres...</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:328</div></div>
288
288
<divclass="ttc" id="agroup__sntp__callback__types_html_gaef268b4cc2cf00e3e573b637cde7c09e"><divclass="ttname"><ahref="group__sntp__callback__types.html#gaef268b4cc2cf00e3e573b637cde7c09e">SntpResolveDns_t</a></div><divclass="ttdeci">bool(* SntpResolveDns_t)(const SntpServerInfo_t *pServerAddr, uint32_t *pIpV4Addr)</div><divclass="ttdoc">Interface for user-defined function to resolve time server domain-name to an IPv4 address....</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:89</div></div>
289
-
<divclass="ttc" id="agroup__sntp__enum__types_html_ga69e2cb17ab4e253491602ccfe48b141f"><divclass="ttname"><ahref="group__sntp__enum__types.html#ga69e2cb17ab4e253491602ccfe48b141f">SntpLeapSecondInfo_t</a></div><divclass="ttdeci">SntpLeapSecondInfo_t</div><divclass="ttdoc">Enumeration for leap second information that an SNTP server can send its response to a time request....</div><divclass="ttdef"><b>Definition:</b> core_sntp_serializer.h:265</div></div>
290
-
<divclass="ttc" id="agroup__sntp__enum__types_html_gaef7b22d8008bbfbbc7bbea5a7a30e798"><divclass="ttname"><ahref="group__sntp__enum__types.html#gaef7b22d8008bbfbbc7bbea5a7a30e798">SntpStatus_t</a></div><divclass="ttdeci">SntpStatus_t</div><divclass="ttdoc">Enumeration of status codes that can be returned by the coreSNTP Library API.</div><divclass="ttdef"><b>Definition:</b> core_sntp_serializer.h:140</div></div>
289
+
<divclass="ttc" id="agroup__sntp__enum__types_html_ga69e2cb17ab4e253491602ccfe48b141f"><divclass="ttname"><ahref="group__sntp__enum__types.html#ga69e2cb17ab4e253491602ccfe48b141f">SntpLeapSecondInfo_t</a></div><divclass="ttdeci">SntpLeapSecondInfo_t</div><divclass="ttdoc">Enumeration for leap second information that an SNTP server can send its response to a time request....</div><divclass="ttdef"><b>Definition:</b> core_sntp_serializer.h:273</div></div>
290
+
<divclass="ttc" id="agroup__sntp__enum__types_html_gaef7b22d8008bbfbbc7bbea5a7a30e798"><divclass="ttname"><ahref="group__sntp__enum__types.html#gaef7b22d8008bbfbbc7bbea5a7a30e798">SntpStatus_t</a></div><divclass="ttdeci">SntpStatus_t</div><divclass="ttdoc">Enumeration of status codes that can be returned by the coreSNTP Library API.</div><divclass="ttdef"><b>Definition:</b> core_sntp_serializer.h:154</div></div>
291
291
<divclass="ttc" id="agroup__sntp__struct__types_html_ga7769e434e7811caed8cd6fd7f9ec26ec"><divclass="ttname"><ahref="group__sntp__struct__types.html#ga7769e434e7811caed8cd6fd7f9ec26ec">NetworkContext_t</a></div><divclass="ttdeci">struct NetworkContext NetworkContext_t</div><divclass="ttdoc">A user-defined type for context that is passed to the transport interface functions....</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:148</div></div>
292
292
<divclass="ttc" id="agroup__sntp__struct__types_html_gaff243b342eebc2622fbb493d08663133"><divclass="ttname"><ahref="group__sntp__struct__types.html#gaff243b342eebc2622fbb493d08663133">SntpAuthContext_t</a></div><divclass="ttdeci">struct SntpAuthContext SntpAuthContext_t</div><divclass="ttdoc">A user-defined type for context that is passed to the authentication interface functions....</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:249</div></div>
293
293
<divclass="ttc" id="astruct_sntp_authentication_interface__t_html"><divclass="ttname"><ahref="struct_sntp_authentication_interface__t.html">SntpAuthenticationInterface_t</a></div><divclass="ttdoc">Struct representing the authentication interface for securely communicating with time servers.</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:343</div></div>
@@ -313,7 +313,7 @@
313
313
<divclass="ttc" id="astruct_sntp_server_info__t_html_a1c2da66f537d838bb5624ece9042771d"><divclass="ttname"><ahref="struct_sntp_server_info__t.html#a1c2da66f537d838bb5624ece9042771d">SntpServerInfo_t::serverNameLen</a></div><divclass="ttdeci">size_t serverNameLen</div><divclass="ttdoc">The length of the server name.</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:70</div></div>
314
314
<divclass="ttc" id="astruct_sntp_server_info__t_html_a2c89b20c6fa40631a1d70000a39a3df5"><divclass="ttname"><ahref="struct_sntp_server_info__t.html#a2c89b20c6fa40631a1d70000a39a3df5">SntpServerInfo_t::port</a></div><divclass="ttdeci">uint16_t port</div><divclass="ttdoc">The UDP port supported by the server for SNTP/NTP communication.</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:71</div></div>
315
315
<divclass="ttc" id="astruct_sntp_server_info__t_html_a3ac6b772408c867c83bc278aebbfe192"><divclass="ttname"><ahref="struct_sntp_server_info__t.html#a3ac6b772408c867c83bc278aebbfe192">SntpServerInfo_t::pServerName</a></div><divclass="ttdeci">const char * pServerName</div><divclass="ttdoc">The time server name.</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:69</div></div>
316
-
<divclass="ttc" id="astruct_sntp_timestamp__t_html"><divclass="ttname"><ahref="struct_sntp_timestamp__t.html">SntpTimestamp_t</a></div><divclass="ttdoc">Structure representing an SNTP timestamp.</div><divclass="ttdef"><b>Definition:</b> core_sntp_serializer.h:284</div></div>
316
+
<divclass="ttc" id="astruct_sntp_timestamp__t_html"><divclass="ttname"><ahref="struct_sntp_timestamp__t.html">SntpTimestamp_t</a></div><divclass="ttdoc">Structure representing an SNTP timestamp.</div><divclass="ttdef"><b>Definition:</b> core_sntp_serializer.h:292</div></div>
317
317
<divclass="ttc" id="astruct_udp_transport_interface__t_html"><divclass="ttname"><ahref="struct_udp_transport_interface__t.html">UdpTransportInterface_t</a></div><divclass="ttdoc">Struct representing the UDP transport interface for user-defined functions that coreSNTP library depe...</div><divclass="ttdef"><b>Definition:</b> core_sntp_client.h:233</div></div>
<trclass="memdesc:a48dc19a11eb31d6077a2ca8964a1c6a9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Utility to calculate the poll interval of sending periodic time queries to servers to achieve a desired system clock accuracy for a given frequency tolerance of the system clock. <br/></td></tr>
<trclass="memdesc:ae2e96d3bc60bb30db3107a2bc1d69121"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Utility to convert SNTP timestamp (that uses 1st Jan 1900 as the epoch) to UNIX timestamp (that uses 1st Jan 1970 as the epoch). <br/></td></tr>
<trclass="memdesc:a9d07377dd8efc162dcd33a53403f8d9a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Utility to convert SNTP timestamp (that uses 1st Jan 1900 as the epoch) to UNIX timestamp (that uses 1st Jan 1970 as the epoch). <br/></td></tr>
<p>Utility to convert SNTP timestamp (that uses 1st Jan 1900 as the epoch) to UNIX timestamp (that uses 1st Jan 1970 as the epoch). </p>
983
-
<dlclass="section note"><dt>Note</dt><dd>This function can ONLY handle conversions of SNTP timestamps that lie in the range from 1st Jan 1970 0h 0m 0s, the UNIX epoch time, to 19th Jan 2038 3h 14m 7s, the maximum UNIX time that can be represented in a signed 32 bit integer. (The limitation is to support systems that use signed 32-bit integer to represent the seconds part of the UNIX time.)</dd>
984
-
<dd>
985
-
This function supports overflow of the SNTP timestamp (from the 7 Feb 2036 6h 28m 16s time, i.e. SNTP era 1) by treating the timestamps with seconds part in the range [0, 61,505,152] seconds where the upper limit represents the UNIX overflow time (i.e. 19 Jan 2038 3h 14m 7s) for systems that use signed 32-bit integer to represent time.</dd></dl>
983
+
<dlclass="section note"><dt>Note</dt><dd>This function converts SNTP timestamps to UNIX time supporting both 32-bit and 64-bit representations based on the configuration macro USE_LEGACY_TIME_API.</dd></dl>
984
+
<ul>
985
+
<li>If USE_LEGACY_TIME_API is defined, the conversion is limited to the date range from 1st Jan 1970 0h 0m 0s (UNIX epoch) to 19th Jan 2038 3h 14m 7s, due to the 32-bit width limitation.</li>
986
+
<li>If USE_LEGACY_TIME_API is not defined, 64-bit UNIX time representation is used, allowing conversion of SNTP timestamps beyond the year 2038 (Y2038 problem mitigated).</li>
987
+
</ul>
988
+
<dlclass="section note"><dt>Note</dt><dd>The function also correctly handles SNTP era overflow (from 7 Feb 2036 6h 28m 16s, i.e., SNTP era 1) to ensure accurate conversion across SNTP eras.</dd></dl>
986
989
<dlclass="params"><dt>Parameters</dt><dd>
987
990
<tableclass="params">
988
991
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">pSntpTime</td><td>The SNTP timestamp to convert to UNIX time. </td></tr>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following:<ul>
995
998
<li><aclass="el" href="group__sntp__enum__types.html#ggaef7b22d8008bbfbbc7bbea5a7a30e798a8486f9ee1815b43418a9c0478bd8f016" title="Successful operation of an SNTP API.">SntpSuccess</a> if conversion to UNIX time is successful</li>
996
-
<li><aclass="el" href="group__sntp__enum__types.html#ggaef7b22d8008bbfbbc7bbea5a7a30e798a1829c0158e4f2630b6806afa4511dfd7" title="Invalid parameter passed to an API function.">SntpErrorBadParameter</a> if any of the passed parameters are NULL.</li>
997
-
<li><aclass="el" href="group__sntp__enum__types.html#ggaef7b22d8008bbfbbc7bbea5a7a30e798afba7203b8ee0322999adf1edcca6e0cf" title="SNTP timestamp cannot be converted to UNIX time as time does not lie in time range supported by Sntp_...">SntpErrorTimeNotSupported</a> if the passed SNTP time does not lie in the supported time range. </li>
999
+
<li><aclass="el" href="group__sntp__enum__types.html#ggaef7b22d8008bbfbbc7bbea5a7a30e798a1829c0158e4f2630b6806afa4511dfd7" title="Invalid parameter passed to an API function.">SntpErrorBadParameter</a> if any of the passed parameters are NULL. </li>
0 commit comments