time#

strftimestamp(timestamp: float, fmt: str = '%b %d %H:%M') str#
timestamp(local: bool = True) float#
time_in_seconds(arg: int | float | str) float#
hhmmss(seconds: float | None, threshold: float = 2.0) str#
pretty_seconds_formatter(seconds: int | float) Callable#
pretty_seconds(seconds: str | int | float) str#

Seconds to string with appropriate units

Parameters:

seconds (float) – Number of seconds

Returns:

Time string with units

Return type:

str

class Duration#

Bases: object

Support for GO lang’s duration format

units = {'d': 86400000000000, 'h': 3600000000000, 'm': 60000000000, 'mm': 2592000000000000, 'ms': 1000000, 'ns': 1, 's': 1000000000, 'us': 1000, 'w': 604800000000000, 'y': 31536000000000000, 'µs': 1000, 'μs': 1000}#
static from_str(duration: str) timedelta#

Parse a duration string to a datetime.timedelta

static to_str(delta: timedelta, extended: bool = False) str#

Format a datetime.timedelta to a duration string

exception DurationError#

Bases: ValueError

duration error