Skip to content
Snippets Groups Projects
Commit f35496be authored by Cain, Payton David's avatar Cain, Payton David
Browse files

Get previous interval from current interval

parent 210de01c
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!52Update legacy
...@@ -568,3 +568,32 @@ def round_usecs(time): ...@@ -568,3 +568,32 @@ def round_usecs(time):
if rounded_usecs != usecs: if rounded_usecs != usecs:
time = time.replace(microsecond=rounded_usecs) time = time.replace(microsecond=rounded_usecs)
return time return time
def get_previous_interval(interval: str):
"""Gets previous available interval from input interval.
Parameters
----------
interval: str
string containing current interval
Returns
----------
interval: str
string containing previous available interval
"""
current_delta = get_delta_from_interval(interval)
if interval == "second":
return "tenhertz"
elif interval == "minute":
return "second"
elif interval in ["hour", "day"]:
return "minute"
else:
raise ValueError(
"Method cannot determine intervals smaller than ten hertz or larger than one minute"
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment