timekeeper.cpp: setmytime return if no timesrc

This commit is contained in:
Verkehrsrot 2019-08-18 22:13:42 +02:00
parent 0a970f3dcf
commit a381f31244
2 changed files with 6 additions and 2 deletions

View File

@ -54,7 +54,7 @@ void calibrateTime(void) {
}
#endif
goto finish;
goto finish;
finish:
@ -66,6 +66,10 @@ finish:
void IRAM_ATTR setMyTime(uint32_t t_sec, uint16_t t_msec,
timesource_t mytimesource) {
// called with invalid timesource?
if (mytimesource == _unsynced)
return;
// increment t_sec only if t_msec > 1000
time_t time_to_set = (time_t)(t_sec + t_msec / 1000);

View File

@ -178,7 +178,7 @@ int recv_timesync_ans(uint8_t seq_no, uint8_t buf[], uint8_t buf_len) {
// the 5th byte contains the fractional seconds in 2^-8 second steps
// (= 1/250th sec), we convert this to ms
uint16_t timestamp_msec = 4 * buf[4];
// pointers to 4 bytes 4 bytes containing UTC seconds since unix epoch, msb
// pointers to 4 bytes containing UTC seconds since unix epoch, msb
uint32_t timestamp_sec, *timestamp_ptr;
// convert buffer to uint32_t, octet order is big endian