]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add monotonic as an alternative to Monotime 1579/head
authorFelix Yan <felixonmars@archlinux.org>
Sat, 7 Nov 2015 05:53:09 +0000 (13:53 +0800)
committerFelix Yan <felixonmars@archlinux.org>
Sat, 7 Nov 2015 06:01:40 +0000 (14:01 +0800)
.travis.yml
docs/index.rst
tornado/platform/auto.py
tox.ini

index 8cc1fbff7e892efde5eca3ab9a58419681d58734..16f61830d490c5a98ffbf810584923973ea4c206 100644 (file)
@@ -11,7 +11,7 @@ python:
     - pypy3
 
 install:
-    - if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then travis_retry pip install futures mock Monotime trollius; fi
+    - if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then travis_retry pip install futures mock monotonic trollius; fi
     - if [[ $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then travis_retry pip install futures mock; fi
     # TODO(bdarnell): pycares tests are currently disabled on travis due to ipv6 issues.
     #- if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then travis_retry pip install pycares; fi
index e4a4d8090f1ec85d3d1bc3d91741504c4758bdcf..14f9af6b43ffd4957cba50e4778dce2e983cba3e 100644 (file)
@@ -100,6 +100,8 @@ the following optional packages may be useful:
 * `Monotime <https://pypi.python.org/pypi/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 <https://pypi.python.org/pypi/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``)
index fc40c9d973321a4c8e82f89adb6da5ed445b12d8..449b634b9bd53e030da07c97c1407c82dfcb3d91 100644 (file)
@@ -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 82b156d1e7624a4b5719c6ef6533248d7cb34570..6f74a745430f3860374461863afe19cfa2903916 100644 (file)
--- 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