summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-07-13 00:14:41 +0000
committerGerrit Code Review <review@openstack.org>2015-07-13 00:14:41 +0000
commit6ee35b0eb58129c1eb4e07ff76b44762041d26e3 (patch)
tree96a52205261ebda6ae161e01913b7c431602e722
parent0fe4fbbedf56255b96a9340fa50a0f6201b88241 (diff)
parenta9ad4412f175472e7d817cc18fa38dc6b3d4bf76 (diff)
downloadoslo-utils-6ee35b0eb58129c1eb4e07ff76b44762041d26e3.tar.gz
Merge "Use monotonic library to avoid finding monotonic time function"1.9.0
-rw-r--r--oslo_utils/timeutils.py14
-rw-r--r--requirements.txt1
2 files changed, 2 insertions, 13 deletions
diff --git a/oslo_utils/timeutils.py b/oslo_utils/timeutils.py
index 17495e4..47859a7 100644
--- a/oslo_utils/timeutils.py
+++ b/oslo_utils/timeutils.py
@@ -23,6 +23,7 @@ import time
from debtcollector import removals
import iso8601
+from monotonic import monotonic as now # noqa
from pytz import timezone
import six
@@ -35,19 +36,6 @@ PERFECT_TIME_FORMAT = _ISO8601_TIME_FORMAT_SUBSECOND
_MAX_DATETIME_SEC = 59
-# Use monotonic time in stopwatches if we can get at it...
-#
-# PEP @ https://www.python.org/dev/peps/pep-0418/
-try:
- now = time.monotonic
-except AttributeError:
- try:
- # Try to use the pypi module if it's available (optionally...)
- from monotonic import monotonic as now
- except (AttributeError, ImportError):
- # Ok fallback to the non-monotonic one...
- now = time.time
-
@removals.remove(
message="use datetime.datetime.isoformat()",
diff --git a/requirements.txt b/requirements.txt
index 98ddc94..e8de632 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,6 +12,7 @@ Babel>=1.3
six>=1.9.0
iso8601>=0.1.9
oslo.i18n>=1.5.0 # Apache-2.0
+monotonic>=0.1 # Apache-2.0
pytz>=2013.6
netaddr>=0.7.12
netifaces>=0.10.4