void ntp_newdata(void) { if (!uip_newdata ()) return; uint32_t ntp_timestamp; struct ntp_packet *pkt = uip_appdata; /* We must save an unix timestamp */ ntp_timestamp = NTOHL(pkt->rec.seconds) - 2208988800; #ifdef DEBUG_NTP debug_printf("NTP: Set new time: %lu\n",ntp_timestamp); #endif clock_set_time(ntp_timestamp); ntp_setstratum(pkt->stratum); }
void ntp_newdata(void) { if (!uip_newdata ()) return; uint32_t ntp_timestamp; struct ntp_packet *pkt = uip_appdata; /* We must save an unix timestamp */ ntp_timestamp = NTOHL(pkt->rec.seconds) - JAN_1970; #ifdef DEBUG_NTP debug_printf("NTP: Set new time: %lu\n",ntp_timestamp); #endif clock_set_time(ntp_timestamp); set_dcf_count(0); set_ntp_count(1); #ifdef NTPD_SUPPORT ntp_setstratum(pkt->stratum); #endif #ifdef DNS_SUPPORT ntp_tries = 0; // reset try counter #endif }