diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-01-04 15:48:59 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-01-04 15:48:59 +0000 |
commit | cad152f0f0593145f3d711b34714758b604415df (patch) | |
tree | 92c6a5256a6a96df04cea99201e7398f25b14343 /openstack | |
parent | 8ed3163c2b3f372402e6bccf7df5f3f3222d8c98 (diff) | |
parent | 09b341db792fa25fe67c560c65f278ce9c70957e (diff) | |
download | oslo-cad152f0f0593145f3d711b34714758b604415df.tar.gz oslo-cad152f0f0593145f3d711b34714758b604415df.tar.xz oslo-cad152f0f0593145f3d711b34714758b604415df.zip |
Merge "Make time comparison functions accept strings"
Diffstat (limited to 'openstack')
-rw-r--r-- | openstack/common/timeutils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/openstack/common/timeutils.py b/openstack/common/timeutils.py index ea69164..e518733 100644 --- a/openstack/common/timeutils.py +++ b/openstack/common/timeutils.py @@ -71,11 +71,15 @@ def normalize_time(timestamp): def is_older_than(before, seconds): """Return True if before is older than seconds.""" + if isinstance(before, str): + before = parse_strtime(before).replace(tzinfo=None) return utcnow() - before > datetime.timedelta(seconds=seconds) def is_newer_than(after, seconds): """Return True if after is newer than seconds.""" + if isinstance(after, str): + after = parse_strtime(after).replace(tzinfo=None) return after - utcnow() > datetime.timedelta(seconds=seconds) |