Skip to content

Commit

Permalink
update: implement std::fmt::Display for Timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
calebpitan committed Oct 24, 2024
1 parent 028d3fd commit 3969183
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/scheduler/src/scheduler/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ impl Timestamp {
}
}

impl std::fmt::Display for Timestamp {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Timestamp::Millis(ms) => write!(f, "{}ms", ms.to_string().as_str()),
Timestamp::Second(sec) => write!(f, "{}s", sec.to_string().as_str()),
}
}
}

impl Add for Timestamp {
type Output = Timestamp;

Expand Down

0 comments on commit 3969183

Please sign in to comment.