blob: c6e30444785599ee6dabebc7ef72a97e2645991d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
//! Keep track of time, both in native and web platforms!
pub use web_time::Duration;
pub use web_time::Instant;
/// Creates a [`Duration`] representing the given amount of milliseconds.
pub fn milliseconds(milliseconds: u64) -> Duration {
Duration::from_millis(milliseconds)
}
/// Creates a [`Duration`] representing the given amount of seconds.
pub fn seconds(seconds: u64) -> Duration {
Duration::from_secs(seconds)
}
/// Creates a [`Duration`] representing the given amount of minutes.
pub fn minutes(minutes: u64) -> Duration {
seconds(minutes * 60)
}
/// Creates a [`Duration`] representing the given amount of hours.
pub fn hours(hours: u64) -> Duration {
minutes(hours * 60)
}
/// Creates a [`Duration`] representing the given amount of days.
pub fn days(days: u64) -> Duration {
hours(days * 24)
}
|