mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-15 23:08:55 +00:00
Create Duration from seconds u64
This commit is contained in:
parent
75f4e403df
commit
063c8baaa9
1 changed files with 7 additions and 0 deletions
|
@ -84,6 +84,13 @@ mod duration {
|
|||
}
|
||||
}
|
||||
|
||||
impl Duration {
|
||||
/// Create a duration from the number of seconds.
|
||||
pub fn from_secs(secs: u64) -> Duration {
|
||||
Duration(StdDuration::from_secs(secs))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Duration {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let d = self;
|
||||
|
|
Loading…
Add table
Reference in a new issue