Skip to content

Commit 9aa9d02

Browse files
quark-zjufacebook-github-bot
authored andcommitted
util: stop using time.perf_counter() for timer()
Summary: Some code paths (ex. metalog.commit) use `util.timer()` as a way to get seconds since epoch, and get 0 for tests. Other use-cases of `util.timer()` are ad-hoc time measure for displaying speed / progress. They do not need high precision or strong guarantee that the clock does not go backwards. Drop the `time.perf_counter()` to meet the first use-case's expectation. Reviewed By: singhsrb Differential Revision: D23431253 fbshipit-source-id: 8bf2d1ed32e284e17285742e1d0fd7178f181fb3
1 parent 9f33746 commit 9aa9d02

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

eden/scm/edenscm/mercurial/util.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,13 +1388,7 @@ def _reloadenv():
13881388

13891389
global timer, getuser, istest
13901390

1391-
if pycompat.iswindows:
1392-
timer = time.clock
1393-
else:
1394-
timer = time.time
1395-
1396-
if safehasattr(time, "perf_counter"):
1397-
timer = time.perf_counter
1391+
timer = time.time
13981392

13991393
if "TESTTMP" in os.environ or "testutil" in sys.modules:
14001394
# Stabilize test output

0 commit comments

Comments
 (0)