      // Write to rtc once per minute when no ignition present
      if ((panda->has_rtc) && !ignition && (no_ignition_cnt % 120 == 1)){
        // Write time to RTC if it looks reasonable
        setenv("TZ","UTC",1);
        struct tm sys_time = get_time();
  
        if (time_valid(sys_time)){
          struct tm rtc_time = panda->get_rtc();
          double seconds = difftime(mktime(&rtc_time), mktime(&sys_time));
  
 
</s> remove     struct tm sys_time = get_time();
 </s> add     struct tm sys_time = util::get_time(); </s> remove     if (!time_valid(sys_time) && time_valid(rtc_time)) {
 </s> add     if (!util::time_valid(sys_time) && util::time_valid(rtc_time)) { </s> remove   struct tm sys_time;
  gmtime_r(&rawtime, &sys_time);

  return sys_time;
}

bool time_valid(struct tm sys_time){
  int year = 1900 + sys_time.tm_year;
  int month = 1 + sys_time.tm_mon;
  return (year > 2020) || (year == 2020 && month >= 10);
}
 </s> add 
      struct tm sys_time = util::get_time();
      // Write to rtc once per minute when no ignition present
      if ((panda->has_rtc) && !ignition && (no_ignition_cnt % 120 == 1)){
        // Write time to RTC if it looks reasonable
        setenv("TZ","UTC",1);
      struct tm sys_time = util::get_time();
  
        if (time_valid(sys_time)){
          struct tm rtc_time = panda->get_rtc();
          double seconds = difftime(mktime(&rtc_time), mktime(&sys_time));
  
keep keep keep keep replace keep keep keep keep keep
 Store almanac on ublox poweroff (#20967)

* Store almanac on ublox poweroff

* send current UTC time

* move message building to ublox_msg.h 
selfdrive/boardd/boardd.cc