Use time.monotonic() where available. #583

wants to merge 2 commits into
Commits on Aug 14, 2012
  1. Disable tests when old versions of twisted are installed.

    apenwarr committed Aug 14, 2012
    Twisted 10.0 (on an older version of Ubuntu) doesn't seem to work with class
    decorators, even on python 2.6.  This makes the tests fail with a TypeError:
    Traceback (most recent call last):
      File "tornado/test/", line 59, in test_import_twisted
        import tornado.platform.twisted
      File "tornado/platform/", line 108, in <module>
        TornadoDelayedCall = implementer(IDelayedCall)(TornadoDelayedCall)
      File "/usr/lib/python2.6/dist-packages/zope/interface/",
    line 496, in __call__
        raise TypeError("Can't use implementer with classes.  Use one of "
    TypeError: Can't use implementer with classes.  Use one of the
    class-declaration functions instead.
    If we catch a typeerror while importing twisted, act like twisted is not
  2. tornado: use time.monotonic() where available.

    apenwarr committed Aug 11, 2012
    In ioloop.add_timeout(), we still support adding timeouts using time.time(),
    but we actually convert them to time.monotonic() before running.  If you
    don't explicitly set monotonic=False when calling add_timeout(), you'll get
    a warning when that happens.
    But mostly, you should really be passing in a datetime.timedelta object,
    because almost always you want to use relative time instead of absolute