The seedbox.common.timeutil
Module¶
Time related utilities and helper functions.
-
seedbox.common.timeutil.
delta_seconds
(before, after)¶ Return the difference between two timing objects.
Compute the difference in seconds between two date, time, or datetime objects (as a float, to microsecond resolution).
Parameters: - before – date, datetime, time object
- after – date, datetime, time object
Returns: difference in seconds
Return type: int
-
seedbox.common.timeutil.
is_newer_than
(after, seconds)¶ Checks if a datetime is newer than seconds
Parameters: - after (datetime) – a datetime to check
- seconds (int) – seconds (delta)
Returns: True if before is newer than seconds else False
Return type: bool
-
seedbox.common.timeutil.
is_older_than
(before, seconds)¶ Checks if a datetime is older than seconds
Parameters: - before (datetime) – a datetime to check
- seconds (int) – seconds (delta)
Returns: True if before is older than seconds else False
Return type: bool
-
seedbox.common.timeutil.
total_seconds
(delta)¶ Return the total seconds of datetime.timedelta object.
Parameters: delta (timedelta) – a delta to convert Returns: seconds Return type: int
-
seedbox.common.timeutil.
utcnow
()¶ Gets current time.
Returns: current time from utc Return type: datetime