Skip to content

Commit

Permalink
don't panic, but return None
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Aug 20, 2024
1 parent 187f635 commit cca50a1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions neqo-common/src/qlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ impl Drop for NeqoQlogShared {
}
}

#[allow(clippy::missing_panics_doc)]
#[must_use]
pub fn new_trace(role: Role) -> qlog::TraceSeq {
TraceSeq {
Expand All @@ -174,15 +173,10 @@ pub fn new_trace(role: Role) -> qlog::TraceSeq {
common_fields: Some(CommonFields {
group_id: None,
protocol_type: None,
reference_time: {
Some(
SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.expect("expect UNIX_EPOCH to always be earlier than now")
.as_secs_f64()
* 1_000.0,
)
},
reference_time: SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.map(|d| d.as_secs_f64() * 1_000.0)
.ok(),
time_format: Some("relative".to_string()),
}),
}
Expand Down

0 comments on commit cca50a1

Please sign in to comment.