diff options
-rw-r--r-- | src/common/src/Core/common.c | 4 | ||||
-rw-r--r-- | src/common/src/Core/main.c | 4 | ||||
-rw-r--r-- | src/common/src/GPS/gps.c | 3 | ||||
-rw-r--r-- | src/simulator/src/Core/main.c | 4 |
4 files changed, 8 insertions, 7 deletions
diff --git a/src/common/src/Core/common.c b/src/common/src/Core/common.c index 9c7d3c5..3102e81 100644 --- a/src/common/src/Core/common.c +++ b/src/common/src/Core/common.c @@ -135,7 +135,7 @@ int local_time(struct tm *time) { if (dst == -1) { usart_debug("mktime fail for dst %d-%d-%d %d:%d:%d " "dst %d wday %d yday %d\r\n", - time->tm_year, time->tm_mon, time->tm_mday, + time->tm_year, time->tm_mon + 1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec, time->tm_isdst, time->tm_wday, time->tm_yday); } @@ -152,7 +152,7 @@ int local_time(struct tm *time) { if (mktime(time) == (time_t)-1) { usart_debug("mktime fail for local_time %d-%d-%d %d:%d:%d " "dst %d wday %d yday %d\r\n", - time->tm_year, time->tm_mon, time->tm_mday, + time->tm_year, time->tm_mon + 1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec, time->tm_isdst, time->tm_wday, time->tm_yday); valid = 0; diff --git a/src/common/src/Core/main.c b/src/common/src/Core/main.c index df736c5..f9c1a08 100644 --- a/src/common/src/Core/main.c +++ b/src/common/src/Core/main.c @@ -411,7 +411,7 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { if (time.tm_sec % 30 == 0 && t_gps_print_latch == 0) { usart_debug("T_GPS %04d-%02d-%02d %02d:%02d:%02d %d SV tracked\r\n", - gps_time.tm_year, gps_time.tm_mon, gps_time.tm_mday, + gps_time.tm_year, gps_time.tm_mon + 1, gps_time.tm_mday, gps_time.tm_hour, gps_time.tm_min, gps_time.tm_sec, num_sv_used); @@ -430,7 +430,7 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { #else time.tm_year, #endif - time.tm_mon, time.tm_mday, + time.tm_mon + 1, time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec, mode); diff --git a/src/common/src/GPS/gps.c b/src/common/src/GPS/gps.c index bc4f549..1db92cb 100644 --- a/src/common/src/GPS/gps.c +++ b/src/common/src/GPS/gps.c @@ -87,7 +87,8 @@ static void gps_task(void __attribute__ ((unused))*pvParameters) { if (minmea_parse_rmc(&frame, rxbuf)) { xSemaphoreTake(timeutc_semaphore, portMAX_DELAY); gps_timeutc.tm_year = 2000 + frame.date.year; - gps_timeutc.tm_mon = frame.date.month; + // struct tm months are zero-indexed + gps_timeutc.tm_mon = frame.date.month - 1; gps_timeutc.tm_mday = frame.date.day; gps_timeutc.tm_hour = frame.time.hours; gps_timeutc.tm_min = frame.time.minutes; diff --git a/src/simulator/src/Core/main.c b/src/simulator/src/Core/main.c index 215ead5..a73306d 100644 --- a/src/simulator/src/Core/main.c +++ b/src/simulator/src/Core/main.c @@ -160,7 +160,7 @@ static void thread_gui_gps(void __attribute__ ((unused))*arg) { if (gui_gps_send_current_time) { - sprintf(gps_frame_buffer + gps_buffer_pointer, "%02d%02d%02d", t->tm_mday, t->tm_mon, t->tm_year - 100); + sprintf(gps_frame_buffer + gps_buffer_pointer, "%02d%02d%02d", t->tm_mday, t->tm_mon + 1, t->tm_year - 100); } else { strcpy(gps_frame_buffer + gps_buffer_pointer, "000000"); @@ -173,7 +173,7 @@ static void thread_gui_gps(void __attribute__ ((unused))*arg) { day = t->tm_mday; } if (!gui_gps_custom_month_on) { - mon = t->tm_mon; + mon = t->tm_mon + 1; } if (!gui_gps_custom_year_on) { year = t->tm_year - 100; |