diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2019-07-25 22:17:22 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-07-27 12:03:01 -0400 |
commit | 6535ec6b95d3b3978fe52ea31523c7bd14f4e95b (patch) | |
tree | ae0dc1ef5fae5cfdc299e4c78584d1264b750ab9 /mako/util.py | |
parent | 74c6bdaf8c631ce9af957edb0ae6c96b17bca6e2 (diff) | |
download | external_python_mako-6535ec6b95d3b3978fe52ea31523c7bd14f4e95b.tar.gz external_python_mako-6535ec6b95d3b3978fe52ea31523c7bd14f4e95b.tar.bz2 external_python_mako-6535ec6b95d3b3978fe52ea31523c7bd14f4e95b.zip |
use timeit.default_timer instead of time.clock() / time.time()
Replaced usage of time.clock() on windows as well as time.time() elsewhere
for microsecond timestamps with timeit.default_timer(), as time.clock() is
being removed in Python 3.8. Pull request courtesy Christoph Reiter.
Fixes: #301
Closes: #302
Pull-request: https://github.com/sqlalchemy/mako/pull/302
Pull-request-sha: a706e952727337702692fd1d8369d259e1600d6e
Change-Id: I24e2cd3d2c02323a6fa2b063e86cabe555df2036
Diffstat (limited to 'mako/util.py')
-rw-r--r-- | mako/util.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mako/util.py b/mako/util.py index 4f1426d..07f7531 100644 --- a/mako/util.py +++ b/mako/util.py @@ -9,6 +9,7 @@ import collections import operator import os import re +import timeit from mako import compat @@ -180,7 +181,7 @@ class LRUCache(dict): def __init__(self, key, value): self.key = key self.value = value - self.timestamp = compat.time_func() + self.timestamp = timeit.default_timer() def __repr__(self): return repr(self.value) @@ -191,7 +192,7 @@ class LRUCache(dict): def __getitem__(self, key): item = dict.__getitem__(self, key) - item.timestamp = compat.time_func() + item.timestamp = timeit.default_timer() return item.value def values(self): |