mirror of https://github.com/eldruin/ds323x-rs
Compare commits
3 Commits
a9b15528c2
...
8366a9273e
| Author | SHA1 | Date |
|---|---|---|
|
|
8366a9273e | |
|
|
ac6247da93 | |
|
|
3b00789e56 |
|
|
@ -36,7 +36,7 @@ where
|
|||
}
|
||||
|
||||
fn set_datetime(&mut self, datetime: &NaiveDateTime) -> Result<(), Self::Error> {
|
||||
if !(2000..=2199).contains(&datetime.year()) {
|
||||
if datetime.year() < 2000 || datetime.year() > 2100 {
|
||||
return Err(Error::InvalidInputData);
|
||||
}
|
||||
let (month, year) = month_year_to_registers(datetime.month() as u8, datetime.year() as u16);
|
||||
|
|
@ -174,7 +174,7 @@ where
|
|||
}
|
||||
|
||||
fn set_year(&mut self, year: u16) -> Result<(), Self::Error> {
|
||||
if !(2000..=2199).contains(&year) {
|
||||
if !(2000..=2100).contains(&year) {
|
||||
return Err(Error::InvalidInputData);
|
||||
}
|
||||
let data = self.iface.read_register(Register::MONTH)?;
|
||||
|
|
@ -197,7 +197,7 @@ where
|
|||
}
|
||||
|
||||
fn set_date(&mut self, date: &rtcc::NaiveDate) -> Result<(), Self::Error> {
|
||||
if !(2000..=2199).contains(&date.year()) {
|
||||
if date.year() < 2000 || date.year() > 2100 {
|
||||
return Err(Error::InvalidInputData);
|
||||
}
|
||||
let (month, year) = month_year_to_registers(date.month() as u8, date.year() as u16);
|
||||
|
|
|
|||
Loading…
Reference in New Issue