Timing utilities#
- commons.timing.get_current_utc() datetime#
Fetch a UTC timezone aware datetime.
- Returns:
The current UTC time as an aware datetime.
- Return type:
- commons.timing.is_within_next_(current_datetime: datetime, expected_datetime: datetime, delta: timedelta = datetime.timedelta(seconds=300)) bool#
Returns true if the times are within X minutes of each other
- Parameters:
current_datetime (datetime.datetime) – Now.
expected_datetime (datetime.datetime) – When you want the thing to occur.
delta (datetime.timedelta) –
Return true if the two datetimes are within this delta.
Defaults to 5 minutes.
- Returns:
True if times within the given delta.
- Return type: