File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -179,11 +179,10 @@ impl DateTimeAccess for Rtc {
179
179
let hours = hours_to_u8 ( self . hours ( ) ?) ?;
180
180
181
181
Ok (
182
- NaiveDate :: from_ymd ( year. into ( ) , month. into ( ) , day. into ( ) ) . and_hms (
183
- hours. into ( ) ,
184
- minutes. into ( ) ,
185
- seconds. into ( ) ,
186
- ) ,
182
+ NaiveDate :: from_ymd_opt ( year. into ( ) , month. into ( ) , day. into ( ) )
183
+ . unwrap ( )
184
+ . and_hms_opt ( hours. into ( ) , minutes. into ( ) , seconds. into ( ) )
185
+ . unwrap ( ) ,
187
186
)
188
187
}
189
188
}
@@ -333,11 +332,7 @@ impl Rtcc for Rtc {
333
332
let minutes = self . minutes ( ) ?;
334
333
let hours = hours_to_u8 ( self . hours ( ) ?) ?;
335
334
336
- Ok ( NaiveTime :: from_hms (
337
- hours. into ( ) ,
338
- minutes. into ( ) ,
339
- seconds. into ( ) ,
340
- ) )
335
+ Ok ( NaiveTime :: from_hms_opt ( hours. into ( ) , minutes. into ( ) , seconds. into ( ) ) . unwrap ( ) )
341
336
}
342
337
343
338
fn weekday ( & mut self ) -> Result < u8 , Self :: Error > {
@@ -370,7 +365,7 @@ impl Rtcc for Rtc {
370
365
let month = self . month ( ) ?;
371
366
let year = self . year ( ) ?;
372
367
373
- Ok ( NaiveDate :: from_ymd ( year. into ( ) , month. into ( ) , day. into ( ) ) )
368
+ Ok ( NaiveDate :: from_ymd_opt ( year. into ( ) , month. into ( ) , day. into ( ) ) . unwrap ( ) )
374
369
}
375
370
}
376
371
You can’t perform that action at this time.
0 commit comments