diff options
| author | ache <ache@ache.one> | 2026-08-04 09:43:58 +0200 |
|---|---|---|
| committer | ache <ache@ache.one> | 2026-08-04 09:43:58 +0200 |
| commit | aecb7ac234ddb38772f3a968c3fa43ec3b507315 (patch) | |
| tree | 8752022ffab608719305103b53209910801f20b4 /src/state.rs | |
Init commit
Diffstat (limited to 'src/state.rs')
| -rw-r--r-- | src/state.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/state.rs b/src/state.rs new file mode 100644 index 0000000..fe1fa4a --- /dev/null +++ b/src/state.rs @@ -0,0 +1,17 @@ +use std::time::{SystemTime, UNIX_EPOCH}; + +pub enum State { + NotYetReceived { time_sent: u64 }, + SendError, + Received { rtt: u64, ttl: u32 }, + Lost, +} + +impl State { + pub fn current_time_ms() -> u64 { + SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_millis() as u64 + } +} |