Skip to content

Commit

Permalink
Merge pull request #1579 from felixonmars/monotonic
Browse files Browse the repository at this point in the history
Add monotonic as an alternative to Monotime
  • Loading branch information
bdarnell committed Nov 7, 2015
2 parents 8c04a78 + d0c6002 commit d9c5bc8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Expand Up @@ -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``)
Expand Down
9 changes: 7 additions & 2 deletions tornado/platform/auto.py
Expand Up @@ -47,8 +47,13 @@ def set_close_exec(fd):
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']
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -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

Expand Down

0 comments on commit d9c5bc8

Please sign in to comment.