ublox-at-cellular-interface

Revision:
23:9098a541452b
Parent:
22:63b1a3c02fb8
Parent:
21:2a500a881a5a
Child:
27:3d709ee8c3e1
--- a/TESTS/unit_tests/default/main.cpp	Mon May 13 13:30:24 2019 +0500
+++ b/TESTS/unit_tests/default/main.cpp	Mon May 20 07:46:43 2019 +0000
@@ -402,9 +402,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;
 
@@ -422,6 +419,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;
@@ -431,6 +430,7 @@
         tr_debug("srand() called");
         localTime = localtime(&timestamp);
         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);
             }