Record relays state

This commit is contained in:
2024-09-17 22:31:51 +02:00
parent 368eb13089
commit 565db05fb0
8 changed files with 165 additions and 19 deletions

View File

@ -15,3 +15,21 @@ pub fn time_millis() -> u128 {
.unwrap()
.as_millis()
}
/// Get the number of the day since 01-01-1970 of a given UNIX timestamp
pub fn day_number(time: u64) -> u64 {
time / (3600 * 24)
}
#[cfg(test)]
mod test {
use crate::utils::time_utils::day_number;
#[test]
fn test_time_of_day() {
assert_eq!(day_number(500), 0);
assert_eq!(day_number(1726592301), 19983);
assert_eq!(day_number(1726592401), 19983);
assert_eq!(day_number(1726498701), 19982);
}
}