Use monotonic library to avoid finding monotonic time function

That library already does this same/equivalent search and
ensures that a monotonically increasing time is made available
so we can just avoid looking around for it ourselves.

Depends-On: I0f07858e96ea3baf46f8a453e253b9ed29c7f7e2

Depends-On: I33bd2d9dff9cb7dc1a50177db7286b7317966784

Change-Id: Idd2109c8947d10cdbd62c53998ab2e31382e8633
This commit is contained in:
Joshua Harlow 2015-06-10 15:11:09 -07:00
parent 667d4ed88b
commit a9ad4412f1
2 changed files with 2 additions and 13 deletions

View File

@ -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()",

View File

@ -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