summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-07-01 17:11:22 +0000
committerGerrit Code Review <review@openstack.org>2013-07-01 17:11:22 +0000
commitfb50f51f06b7429e8ca1f6247713e9fed0ee7bc2 (patch)
tree97e5c1e147d35b5a3e65389359fd6f848ff49038
parentbc7e5c8996c1c16a90defc65519f8497e345d91d (diff)
parentd28fa6983bb628c6d111a5f16e222f7b020a3b94 (diff)
downloadoslo-fb50f51f06b7429e8ca1f6247713e9fed0ee7bc2.zip
oslo-fb50f51f06b7429e8ca1f6247713e9fed0ee7bc2.tar.gz
oslo-fb50f51f06b7429e8ca1f6247713e9fed0ee7bc2.tar.xz
Merge "python3: Add python3 compatibility."
-rw-r--r--openstack/common/timeutils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/openstack/common/timeutils.py b/openstack/common/timeutils.py
index ac2441b..bd60489 100644
--- a/openstack/common/timeutils.py
+++ b/openstack/common/timeutils.py
@@ -23,6 +23,7 @@ import calendar
import datetime
import iso8601
+import six
# ISO 8601 extended time format with microseconds
@@ -75,14 +76,14 @@ def normalize_time(timestamp):
def is_older_than(before, seconds):
"""Return True if before is older than seconds."""
- if isinstance(before, basestring):
+ if isinstance(before, six.string_types):
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, basestring):
+ if isinstance(after, six.string_types):
after = parse_strtime(after).replace(tzinfo=None)
return after - utcnow() > datetime.timedelta(seconds=seconds)