ublox-at-cellular-interface
Diff: TESTS/unit_tests/default/main.cpp
- Revision:
- 21:2a500a881a5a
- Parent:
- 12:ff6fac481487
- Child:
- 23:9098a541452b
diff -r 2e8e1c573e18 -r 2a500a881a5a TESTS/unit_tests/default/main.cpp --- a/TESTS/unit_tests/default/main.cpp Tue Feb 12 18:42:43 2019 +0500 +++ b/TESTS/unit_tests/default/main.cpp Wed May 08 14:54:33 2019 +0500 @@ -399,9 +399,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; @@ -419,6 +416,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; @@ -428,6 +427,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); }