Commits

Matt Chaput committed 5a65fee

Changed util.now() to use time.perf_counter() on Python 3.3.

  • Participants
  • Parent commits 362fc29

Comments (0)

Files changed (2)

File src/whoosh/util/__init__.py

 IDCHARS = "0123456789abcdefghijklmnopqrstuvwxyz"
 
 
-if sys.platform == 'win32':
+if hasattr(time, "perf_counter"):
+    now = time.perf_counter
+elif sys.platform == 'win32':
     now = time.clock
 else:
     now = time.time

File tests/test_misc.py

 from whoosh.util.testing import TempStorage
 
 
+def test_now():
+    import time
+    from whoosh.util import now
+
+    t1 = now()
+    t2 = now()
+    assert t1 < t2
+
+
 def test_storage_creation():
     import tempfile, uuid
     from whoosh import fields