stm32/rtc: remove use of deprecated .timestamp()

This commit is contained in:
Dario Nieuwenhuis 2024-03-06 19:45:57 +01:00
parent 6d35e3f63c
commit f3efa4ee3b
4 changed files with 7 additions and 7 deletions

View file

@ -28,7 +28,7 @@ async fn main(_spawner: Spawner) {
loop { loop {
let now: NaiveDateTime = rtc.now().unwrap().into(); let now: NaiveDateTime = rtc.now().unwrap().into();
info!("{}", now.timestamp()); info!("{}", now.and_utc().timestamp());
Timer::after_millis(1000).await; Timer::after_millis(1000).await;
} }

View file

@ -24,7 +24,7 @@ async fn main(_spawner: Spawner) {
.unwrap(); .unwrap();
let mut rtc = Rtc::new(p.RTC, RtcConfig::default()); let mut rtc = Rtc::new(p.RTC, RtcConfig::default());
info!("Got RTC! {:?}", now.timestamp()); info!("Got RTC! {:?}", now.and_utc().timestamp());
rtc.set_datetime(now.into()).expect("datetime not set"); rtc.set_datetime(now.into()).expect("datetime not set");
@ -32,5 +32,5 @@ async fn main(_spawner: Spawner) {
Timer::after_millis(20000).await; Timer::after_millis(20000).await;
let then: NaiveDateTime = rtc.now().unwrap().into(); let then: NaiveDateTime = rtc.now().unwrap().into();
info!("Got RTC! {:?}", then.timestamp()); info!("Got RTC! {:?}", then.and_utc().timestamp());
} }

View file

@ -40,7 +40,7 @@ async fn main(_spawner: Spawner) {
.unwrap(); .unwrap();
let mut rtc = Rtc::new(p.RTC, RtcConfig::default()); let mut rtc = Rtc::new(p.RTC, RtcConfig::default());
info!("Got RTC! {:?}", now.timestamp()); info!("Got RTC! {:?}", now.and_utc().timestamp());
rtc.set_datetime(now.into()).expect("datetime not set"); rtc.set_datetime(now.into()).expect("datetime not set");
@ -48,5 +48,5 @@ async fn main(_spawner: Spawner) {
Timer::after_millis(20000).await; Timer::after_millis(20000).await;
let then: NaiveDateTime = rtc.now().unwrap().into(); let then: NaiveDateTime = rtc.now().unwrap().into();
info!("Got RTC! {:?}", then.timestamp()); info!("Got RTC! {:?}", then.and_utc().timestamp());
} }

View file

@ -40,7 +40,7 @@ async fn main(_spawner: Spawner) {
.unwrap(); .unwrap();
let mut rtc = Rtc::new(p.RTC, RtcConfig::default()); let mut rtc = Rtc::new(p.RTC, RtcConfig::default());
info!("Got RTC! {:?}", now.timestamp()); info!("Got RTC! {:?}", now.and_utc().timestamp());
rtc.set_datetime(now.into()).expect("datetime not set"); rtc.set_datetime(now.into()).expect("datetime not set");
@ -48,5 +48,5 @@ async fn main(_spawner: Spawner) {
Timer::after_millis(20000).await; Timer::after_millis(20000).await;
let then: NaiveDateTime = rtc.now().unwrap().into(); let then: NaiveDateTime = rtc.now().unwrap().into();
info!("Got RTC! {:?}", then.timestamp()); info!("Got RTC! {:?}", then.and_utc().timestamp());
} }