From 28bfae346e1f6c3f31cc1a19c758b0e583b6e97e Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 27 Jan 2019 22:12:56 +0100 Subject: [PATCH] cyclic.cpp: bugfix set rtctime by gps --- src/cyclic.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cyclic.cpp b/src/cyclic.cpp index 6b4b5c88..312d3aa0 100644 --- a/src/cyclic.cpp +++ b/src/cyclic.cpp @@ -130,18 +130,14 @@ void do_timesync() { gps.date.day(), gps.date.month(), gps.date.year()); // set RTC time to time source GPS, if RTC is present #ifdef HAS_RTC - RtcDateTime t; - t.year = gps.time.year(); - t.month = gps.date.month(); - t.dayOfMonth = gps.date.day(); - t.hour = gps.time.hour(); - t.minute = gps.time.minute(); - t.second = gps.time.second(); + RtcDateTime t = + RtcDateTime(gps.date.year(), gps.date.month(), gps.date.day(), + gps.time.hour(), gps.time.minute(), gps.time.second()); set_rtctime(t); #endif - time_t t = now(); + time_t tt = now(); ESP_LOGI(TAG, "GPS has set system time to %02d/%02d/%d %02d:%02d:%02d", - month(t), day(t), year(t), hour(t), minute(t), second(t)); + month(tt), day(tt), year(tt), hour(tt), minute(tt), second(tt)); return; } else { ESP_LOGI(TAG, "No valid GPS time");