-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
12 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,3 @@ | ||
use std::ops::Deref; | ||
|
||
#[derive(Copy, Clone, Debug)] | ||
pub struct TimeNanoseconds(pub i64); | ||
|
||
impl Deref for TimeNanoseconds { | ||
type Target = i64; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl From<i64> for TimeNanoseconds { | ||
fn from(v: i64) -> Self { | ||
TimeNanoseconds(v) | ||
} | ||
} | ||
|
||
#[derive(Copy, Clone, Debug)] | ||
pub struct TimeMilliseconds(i64); | ||
|
||
impl Deref for TimeMilliseconds { | ||
type Target = i64; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl From<i64> for TimeMilliseconds { | ||
fn from(v: i64) -> Self { | ||
TimeMilliseconds(v) | ||
} | ||
} | ||
|
||
impl TimeNanoseconds { | ||
pub fn to_millisecs(self) -> TimeMilliseconds { | ||
(*self / 1000_0000).into() | ||
} | ||
} | ||
|
||
impl TimeMilliseconds { | ||
pub fn to_nsecs(self) -> TimeNanoseconds { | ||
(*self * 1000_0000).into() | ||
} | ||
} | ||
pub type TimeNanoseconds = i64; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters