Time
Some objects and functions require argument of time. Here is a list of available time scales formats.
Time scale | Expression |
---|---|
nanoseconds | “nanos” / “nsec” / “ns” |
microseconds | “usec” / “us” |
milliseconds | “millis” / “msec” / “ms” |
seconds | “seconds” / “second” / “secs” / “sec” / “s” |
minutes | “minutes” / “minute” / “min” / “mins” / “m” |
hours | “hours” / “hour” / “hr” / “hrs” / “h” |
days | “days” / “day” / “d” |
weeks | “weeks” / “week” / “w” |
months | “months” / “month” / “M” |
years | “years” / “year” / “y” |
Time scales and their expressions
For reference, the humantime crate is used to parse time.
const my_command = cmd::build(#{
// for the `cmd` service, a timeout for the command can be specified.
// Use the different time scales above to specify the time.
timeout: "10s",
// timeout: "200usec",
// timeout: "1minute",
// timeout: "10000nsec",
// ...
});
Declaring a service that requires a time value