From 09f21403ec36352ac02133f926ffa64e1073280c Mon Sep 17 00:00:00 2001 From: Philipp_EndevourOS Date: Sat, 4 Oct 2025 15:45:56 +0200 Subject: [PATCH] changed Date to u8 array --- src/init/sd_card.rs | 4 ++-- src/store/id_store.rs | 9 +++++---- src/store/mod.rs | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/init/sd_card.rs b/src/init/sd_card.rs index 9fa50d8..23f6bd7 100644 --- a/src/init/sd_card.rs +++ b/src/init/sd_card.rs @@ -83,10 +83,10 @@ impl Persistence for SDCardPersistence { let mut root_dir = vol_0.open_root_dir().unwrap(); let mut days_dir = root_dir.open_dir("days").unwrap(); - let mut days = Vec::new(); + let mut days: Vec<[u8; 10]> = Vec::new(); days_dir .iterate_dir(|e| { - days.push(1); + days.push([0; 10]); }) .unwrap(); diff --git a/src/store/id_store.rs b/src/store/id_store.rs index d122c77..7887254 100644 --- a/src/store/id_store.rs +++ b/src/store/id_store.rs @@ -1,3 +1,5 @@ +use crate::drivers::rtc; +use crate::drivers::rtc::RTCClock; use crate::store::persistence::Persistence; use super::Date; @@ -45,8 +47,8 @@ impl IDStore { // Some(map) => map, // None => IDMapping::new(), // }; - - let current_date: Date = 1; + + let current_date: Date = [0; 10]; let day = persistence_layer .load_day(current_date) @@ -72,8 +74,7 @@ impl IDStore { /// Add a new id for the current day /// Returns false if ID is already present at the current day. - pub async fn add_id(&mut self, id: TallyID) -> bool { - let current_date: Date = 1; + pub async fn add_id(&mut self, id: TallyID, current_date: Date) -> bool { if self.current_day.date == current_date { let changed = self.current_day.add_id(id); diff --git a/src/store/mod.rs b/src/store/mod.rs index ae39628..52f6ad2 100644 --- a/src/store/mod.rs +++ b/src/store/mod.rs @@ -5,5 +5,5 @@ mod id_store; pub use id_mapping::{IDMapping, Name}; pub use id_store::{IDStore,AttendanceDay}; -pub type TallyID = [u8; 8]; -pub type Date = u64; +pub type TallyID = [u8; 12]; +pub type Date = [u8; 10];