Skip to content

Commit

Permalink
Print a timestamp from time to time
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanruth committed Apr 12, 2024
1 parent d327b81 commit ff4824c
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 20 deletions.
152 changes: 152 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ oob = []
[dependencies]
anyhow = "1.0.80"
argsplitter = "0.5.0"
chrono = "0.4.37"
ctrlc = "3.4.2"
etherparse = "0.14.2"
is-terminal = "0.4.12"
Expand Down
1 change: 1 addition & 0 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl<'a> ConnectionSink<'a> {

/// A timestamp represented as a [Duration] since the
/// [UNIX_EPOCH][std::time::UNIX_EPOCH].
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Timestamp(pub Duration);

impl From<SystemTime> for Timestamp {
Expand Down
3 changes: 2 additions & 1 deletion src/mapi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ impl State {

pub fn handle(
&mut self,
_timestamp: &Timestamp,
timestamp: &Timestamp,
event: &MapiEvent,
renderer: &mut Renderer,
) -> io::Result<()> {
renderer.set_timestamp(timestamp);
match event {
MapiEvent::BoundPort(port) => {
renderer.message(None, None, format_args!("LISTEN on port {port}"))?;
Expand Down

0 comments on commit ff4824c

Please sign in to comment.