mirror of https://github.com/zulip/zulip.git
zulip_tools.py: Add `get_threshold_timestamp()` function.
Given `threshold_days` this function returns a timestamp corresponding to the time before threshold number of days.
This commit is contained in:
parent
8954605726
commit
e71f92b09e
|
@ -173,3 +173,11 @@ def get_recent_deployments(threshold_days):
|
|||
if os.path.exists("/root/zulip"):
|
||||
recent.add("/root/zulip")
|
||||
return recent
|
||||
|
||||
def get_threshold_timestamp(threshold_days):
|
||||
# type: (int) -> int
|
||||
# Given number of days, this function returns timestamp corresponding
|
||||
# to the time prior to given number of days.
|
||||
threshold = datetime.datetime.now() - datetime.timedelta(days=threshold_days)
|
||||
threshold_timestamp = int(time.mktime(threshold.utctimetuple()))
|
||||
return threshold_timestamp
|
||||
|
|
Loading…
Reference in New Issue