chronaxis.parse_duration
Import this object from chronaxis. This page covers its directly public members and necessary construction/context protocols. See the Chinese implementation reference for internals. Return to the public API index. Check required parameters, defaults, returns, and exceptions before calling.
parse_duration
Parse a nonnegative duration with a unit, including explicit zero.
python
parse_duration(text: str) -> TimeConversion| Name | Type | Required | Default | Purpose, choices, and effect |
|---|---|---|---|---|
text |
str | Yes | No default | Positional or keyword. Complete value with suffix, for example 500ms, 3s, or 0ns. |
Returns TimeConversion with a nanosecond duration and the original unit-bearing text.
Raises TypeError for non-text input; ValueError for missing units, invalid syntax, or a negative original value, even if it would round to zero; and TimeOverflowError for conversion/rounding outside int64.
Source locations
src/chronaxis/timebase/conversion.py:210— line at8904c2f744951857659abd40aaa3535d57faf53c.