-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
c:cliComponent: Changes the Command Line Interface (CLI).Component: Changes the Command Line Interface (CLI).c:plugin-systemComponent: Changes the plugin system or plugin related.Component: Changes the plugin system or plugin related.
Milestone
Description
Goal
Represents a duration. A duration is represented as ISO8601 string.
Use Cases
- Calculate with two durations, for example add two durations (1 day + 1 day = 2 days)
- Calculate with a date time and a duration (see Date Calculation #23)
- Use durations in schedulers / periodically executed tasks
- Execute task every
duration - Execute task in
duration
- Execute task every
- Use durations for defining lifetimes
- A particle lives for
duration - A projectile explodes in
duration - A game ends in
duration - The game last
duration
- A particle lives for
- Use durations for polling
- Send HTTP Request every
duration - Synchronize
somethingeveryduration
- Send HTTP Request every
Tasks
- Component Duration
- Property
duration(string)- Extension
duration_format
- Extension
- Property
- Implement Component Model
-
to_duration() -> std::time::Duration -
from_iso8601_duration(iso8601_duration_str: String) -
parse(duration_with_time_unit: String)(https://crates.io/crates/fundu#time-units) - from f64
-
as_secs() -> u64(https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs) -
as_millis() -> u128(https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_millis)
-
- Implement Behaviours
- From: Creates a duration (string) from a number of time units
-
from_millis(millis) -> result -
from_secs(sec) -> result -
from_secs(sec) -> result
-
- Calculate with durations
-
add(lhs, rhs) -> result -
sub(lhs, rhs) -> result -
mul(lhs, rhs) -> result -
div(lhs, rhs) -> result
-
- From: Creates a duration (string) from a number of time units
Reference
- https://en.wikipedia.org/wiki/ISO_8601#Durations
- https://doc.rust-lang.org/std/time/struct.Duration.html
Crates
Metadata
Metadata
Assignees
Labels
c:cliComponent: Changes the Command Line Interface (CLI).Component: Changes the Command Line Interface (CLI).c:plugin-systemComponent: Changes the plugin system or plugin related.Component: Changes the plugin system or plugin related.