Skip to content

Commit

Permalink
Serialize journal time stamp as number (not as a datetime string)
Browse files Browse the repository at this point in the history
  • Loading branch information
spirali committed Sep 20, 2024
1 parent 78b1f59 commit 91278b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/hyperqueue/src/server/event/log/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _)
Expand Down
2 changes: 2 additions & 0 deletions crates/hyperqueue/src/server/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -11,6 +12,7 @@ pub type EventId = u32;

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Event {
#[serde(with = "ts_milliseconds")]
pub time: DateTime<Utc>,
pub payload: EventPayload,
}
Expand Down

0 comments on commit 91278b5

Please sign in to comment.