Check the clock-halted flag every time the clock is read, not just once
at startup. The flag stays set until the clock is loaded with good time, so we need to keep saying the time is invalid until that happens.
This commit is contained in:
parent
e9c9826673
commit
bf9c1267f3
@ -328,6 +328,10 @@ ds1307_gettime(device_t dev, struct timespec *ts)
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* If the clock halted, we don't have good data. */
|
||||
if (data[DS1307_SECS] & DS1307_SECS_CH)
|
||||
return (EINVAL);
|
||||
|
||||
/* If chip is in AM/PM mode remember that. */
|
||||
if (data[DS1307_HOUR] & DS1307_HOUR_USE_AMPM) {
|
||||
sc->sc_use_ampm = true;
|
||||
|
Loading…
Reference in New Issue
Block a user