Skip to content

Commit

Permalink
Add some missing parameter and return type information.
Browse files Browse the repository at this point in the history
  • Loading branch information
glyph committed Aug 13, 2014
1 parent e943476 commit 550e0b6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mimic/util/helper.py
Expand Up @@ -49,7 +49,17 @@ def current_time_in_utc():
def set_resource_status(updated_time, time_delta, status='ACTIVE'):
"""
Given the updated_time and time delta, if the updated_time + time_delta is
greater than the current time in UTC, returns the given status.
greater than the current time in UTC, returns the given status; otherwise
return None.
:param str updated_time: The time that the server was last updated by a
client.
:param int time_delta: The delta, in seconds, from ``updated_time``.
:param str status: The status to return if the time_delta has expired (i.e.
the wall clock has advanced more than ``time_delta`` past
``updated_time``).
:return: ``status`` or ``None``.
"""
if (datetime.strptime(updated_time, fmt) + timedelta(seconds=time_delta)) < \
datetime.utcnow():
Expand Down

0 comments on commit 550e0b6

Please sign in to comment.