ChronaxisUser manual中文
On this pageparse_durationSource locations

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

Chronaxis user manual · Offline edition