mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
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:
committed by
Tim Abbott
parent
8954605726
commit
e71f92b09e
@@ -173,3 +173,11 @@ def get_recent_deployments(threshold_days):
|
|||||||
if os.path.exists("/root/zulip"):
|
if os.path.exists("/root/zulip"):
|
||||||
recent.add("/root/zulip")
|
recent.add("/root/zulip")
|
||||||
return recent
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user