diff --git a/crates/hyperqueue/src/server/event/log/read.rs b/crates/hyperqueue/src/server/event/log/read.rs index c7128c8bf..1e34c54c1 100644 --- a/crates/hyperqueue/src/server/event/log/read.rs +++ b/crates/hyperqueue/src/server/event/log/read.rs @@ -230,7 +230,7 @@ mod tests { let mut reader = EventLogReader::open(&path).unwrap(); let event = (&mut reader).next().unwrap().unwrap(); - assert_eq!(event.time, time); + assert_eq!(event.time.timestamp_millis(), time.timestamp_millis()); assert!(matches!( event.payload, EventPayload::AllocationFinished(0, _) diff --git a/crates/hyperqueue/src/server/event/mod.rs b/crates/hyperqueue/src/server/event/mod.rs index 97b084648..5dc5a7fc9 100644 --- a/crates/hyperqueue/src/server/event/mod.rs +++ b/crates/hyperqueue/src/server/event/mod.rs @@ -3,6 +3,7 @@ pub mod payload; pub mod streamer; use bincode::Options; +use chrono::serde::ts_milliseconds; use chrono::{DateTime, Utc}; use payload::EventPayload; use serde::{Deserialize, Serialize}; @@ -11,6 +12,7 @@ pub type EventId = u32; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Event { + #[serde(with = "ts_milliseconds")] pub time: DateTime, pub payload: EventPayload, }