edrx change set
Diff: TESTS/unit_tests/dynamic/main.cpp
- Revision:
- 21:2a500a881a5a
- Parent:
- 14:e7dcf3388403
--- a/TESTS/unit_tests/dynamic/main.cpp Tue Feb 12 18:42:43 2019 +0500 +++ b/TESTS/unit_tests/dynamic/main.cpp Wed May 08 14:54:33 2019 +0500 @@ -128,9 +128,6 @@ { char ntp_values[48] = { 0 }; time_t timestamp = 0; - struct tm *localTime; - char timeString[25]; - time_t TIME1970 = 2208988800U; int len; bool comms_done = false; @@ -148,6 +145,8 @@ tr_debug("UDP: %d byte(s) returned by NTP server.", len); if (len >= 43) { + struct tm *localTime; + time_t TIME1970 = 2208988800U; timestamp |= ((int) *(ntp_values + 40)) << 24; timestamp |= ((int) *(ntp_values + 41)) << 16; timestamp |= ((int) *(ntp_values + 42)) << 8; @@ -157,6 +156,7 @@ tr_debug("srand() called"); localTime = localtime(×tamp); if (localTime) { + char timeString[25]; if (strftime(timeString, sizeof(timeString), "%a %b %d %H:%M:%S %Y", localTime) > 0) { printf("NTP timestamp is %s.\n", timeString); }