Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 01bd185

Browse files
author
Rain Liu
committed
refactoring duration_since
1 parent be21f95 commit 01bd185

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/description/session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::collections::HashMap;
2-
use std::time::{SystemTime, UNIX_EPOCH};
2+
use std::time::{Duration, SystemTime, UNIX_EPOCH};
33
use std::{fmt, io};
44
use url::Url;
55

@@ -248,7 +248,7 @@ impl SessionDescription {
248248
session_id: new_session_id(),
249249
session_version: SystemTime::now()
250250
.duration_since(UNIX_EPOCH)
251-
.expect("Time went backwards")
251+
.unwrap_or_else(|_| Duration::from_secs(0))
252252
.subsec_nanos() as u64,
253253
network_type: "IN".to_string(),
254254
address_type: "IP4".to_string(),

0 commit comments

Comments
 (0)