@@ -31,7 +31,7 @@ DateTime::DateTime(Controllers::Settings& settingsController) : settingsControll
3131 xSemaphoreGive (mutex);
3232
3333 // __DATE__ is a string of the format "MMM DD YYYY", so an offset of 7 gives the start of the year
34- SetTime (compileTimeAtoi (&__DATE__[7 ]), 1 , 1 , 0 , 0 , 0 );
34+ SetTime (compileTimeAtoi (&__DATE__[7 ]), 1 , 1 , 0 , 0 , 0 , false );
3535}
3636
3737void DateTime::SetCurrentTime (std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> t) {
@@ -41,7 +41,7 @@ void DateTime::SetCurrentTime(std::chrono::time_point<std::chrono::system_clock,
4141 xSemaphoreGive (mutex);
4242}
4343
44- void DateTime::SetTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second) {
44+ void DateTime::SetTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, bool log ) {
4545 std::tm tm = {
4646 /* .tm_sec = */ second,
4747 /* .tm_min = */ minute,
@@ -51,8 +51,11 @@ void DateTime::SetTime(uint16_t year, uint8_t month, uint8_t day, uint8_t hour,
5151 /* .tm_year = */ year - 1900 ,
5252 };
5353
54- NRF_LOG_INFO (" %d %d %d " , day, month, year);
55- NRF_LOG_INFO (" %d %d %d " , hour, minute, second);
54+ if (log)
55+ {
56+ NRF_LOG_INFO (" %d %d %d " , day, month, year);
57+ NRF_LOG_INFO (" %d %d %d " , hour, minute, second);
58+ }
5659
5760 tm.tm_isdst = -1 ; // Use DST value from local time zone
5861
0 commit comments