contrib/perf.py
changeset 31823 f6d77af84ef3
parent 31476 413b44003462
child 32202 ded48ad55146
--- a/contrib/perf.py	Wed Apr 05 15:31:08 2017 -0700
+++ b/contrib/perf.py	Thu Apr 06 14:41:42 2017 +0200
@@ -67,6 +67,16 @@
 setattr(util, 'safehasattr', safehasattr)
 
 # for "historical portability":
+# define util.timer forcibly, because util.timer has been available
+# since ae5d60bb70c9
+if safehasattr(time, 'perf_counter'):
+    util.timer = time.perf_counter
+elif os.name == 'nt':
+    util.timer = time.clock
+else:
+    util.timer = time.time
+
+# for "historical portability":
 # use locally defined empty option list, if formatteropts isn't
 # available, because commands.formatteropts has been available since
 # 3.2 (or 7a7eed5176a4), even though formatting itself has been