commit 7861716d2315606b03c4126505d6b158640218aa Author: Felix Yan Date: Sat Nov 7 13:53:09 2015 +0800 Add monotonic as an alternative to Monotime diff --git a/docs/index.rst b/docs/index.rst index e4a4d80..14f9af6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -100,6 +100,8 @@ the following optional packages may be useful: * `Monotime `_ adds support for a monotonic clock, which improves reliability in environments where clock adjustments are frequent. No longer needed in Python 3.3. +* `monotonic `_ adds support for + a monotonic clock. Alternative to Monotime. No longer needed in Python 3.3. **Platforms**: Tornado should run on any Unix-like platform, although for the best performance and scalability only Linux (with ``epoll``) diff --git a/tornado/platform/auto.py b/tornado/platform/auto.py index fc40c9d..449b634 100644 --- a/tornado/platform/auto.py +++ b/tornado/platform/auto.py @@ -47,8 +47,13 @@ try: except ImportError: pass try: - from time import monotonic as monotonic_time + # monotonic can provide a monotonic function in versions of python before + # 3.3, too. + from monotonic import monotonic as monotonic_time except ImportError: - monotonic_time = None + try: + from time import monotonic as monotonic_time + except ImportError: + monotonic_time = None __all__ = ['Waker', 'set_close_exec', 'monotonic_time'] diff --git a/tox.ini b/tox.ini index 82b156d..6f74a74 100644 --- a/tox.ini +++ b/tox.ini @@ -85,7 +85,7 @@ deps = {py2,py27,pypy,py3,py33}-full: singledispatch py33-asyncio: asyncio trollius: trollius - py2-monotonic: Monotime + py2-monotonic: monotonic sphinx: sphinx sphinx: sphinx_rtd_theme