round_datetime_up#

round_datetime_up(ts, delta, offset=datetime.timedelta(0))[source]#

Snap to next available timedelta.

Preserve any timezone info on ts.

If we are at the the given exact delta, then do not round, only add offset.

Parameters:
  • ts (datetime) – Timestamp we want to round

  • delta (timedelta) – Our snap grid

  • offset (timedelta) – Add a fixed time offset at the top of rounding

Returns:

When to wake up from the sleep next time

Return type:

datetime