We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34a8cba commit 0194701Copy full SHA for 0194701
1 file changed
NetX/src/u_nx_ethernet.c
@@ -525,8 +525,15 @@ UINT ethernet_mqtt_reconnect(void) {
525
#endif
526
527
NX_PTP_DATE_TIME ethernet_get_time(void) {
528
- NX_PTP_TIME tm;
529
- NX_PTP_DATE_TIME date;
+ NX_PTP_TIME tm = { 0 };
+ NX_PTP_DATE_TIME date = { 0 };
530
+
531
+ /* If not initialized, don't try to read PTP yet. */
532
+ if(!device.is_initialized) {
533
+ PRINTLN_ERROR("Tried getting PTP time before device has been initialized.");
534
+ return date;
535
+ }
536
537
/* read the PTP clock */
538
nx_ptp_client_time_get(&device.ptp_client, &tm);
539
0 commit comments