iced_core/
time.rs

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