mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-09-12 00:01:13 +00:00
Motivated by https://github.com/KumoCorp/kumomta/pull/403, this commit introduces reasonably full featured Time and TimeDelta types built atop the chrono crate. closes: https://github.com/KumoCorp/kumomta/pull/403
24 lines
382 B
Markdown
24 lines
382 B
Markdown
# kumo.time.parse_duration
|
|
|
|
{{since('dev')}}
|
|
|
|
```lua
|
|
local time = kumo.time.parse_duration(DURATION)
|
|
```
|
|
|
|
Parses a duration to create a [TimeDelta](TimeDelta.md) object.
|
|
|
|
`DURATION` can be:
|
|
|
|
* A signed integer number of seconds
|
|
* A signed floating point number of seconds
|
|
* A duration string like `5 minutes`
|
|
|
|
## Example
|
|
|
|
```lua
|
|
local delta = kumo.time.parse_duration '5m'
|
|
```
|
|
|
|
|