Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 44017:6b90f5c89cb4
py3: replace `time.clock()` with `time.perf_counter()`
The former was removed in 3.8. The util function uses `time.clock()` if the
latter is unavailable.
Differential Revision: https://phab.mercurial-scm.org/D7779
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 30 Dec 2019 23:53:53 -0500 |
parents | be8552f25cab |
children | ef11dfc56674 |
comparison
equal
deleted
inserted
replaced
44016:1e0783b946c8 | 44017:6b90f5c89cb4 |
---|---|
13 import os | 13 import os |
14 import pdb | 14 import pdb |
15 import re | 15 import re |
16 import signal | 16 import signal |
17 import sys | 17 import sys |
18 import time | |
19 import traceback | 18 import traceback |
20 | 19 |
21 | 20 |
22 from .i18n import _ | 21 from .i18n import _ |
23 from .pycompat import getattr | 22 from .pycompat import getattr |
1038 if options[b"time"]: | 1037 if options[b"time"]: |
1039 | 1038 |
1040 def get_times(): | 1039 def get_times(): |
1041 t = os.times() | 1040 t = os.times() |
1042 if t[4] == 0.0: | 1041 if t[4] == 0.0: |
1043 # Windows leaves this as zero, so use time.clock() | 1042 # Windows leaves this as zero, so use time.perf_counter() |
1044 t = (t[0], t[1], t[2], t[3], time.clock()) | 1043 t = (t[0], t[1], t[2], t[3], util.timer()) |
1045 return t | 1044 return t |
1046 | 1045 |
1047 s = get_times() | 1046 s = get_times() |
1048 | 1047 |
1049 def print_time(): | 1048 def print_time(): |