Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hook.py @ 30995:22fbca1d11ed
mercurial: switch to util.timer for all interval timings
util.timer is now the best available interval timer, at the expense of not
having a known epoch. Let's use it whenever the epoch is irrelevant.
author | Simon Farnsworth <simonfar@fb.com> |
---|---|
date | Wed, 15 Feb 2017 13:17:39 -0800 |
parents | 20a42325fdef |
children | a48c6ac5c13a |
line wrap: on
line diff
--- a/mercurial/hook.py Wed Feb 15 11:53:59 2017 -0800 +++ b/mercurial/hook.py Wed Feb 15 13:17:39 2017 -0800 @@ -9,7 +9,6 @@ import os import sys -import time from .i18n import _ from . import ( @@ -88,7 +87,7 @@ % (hname, funcname)) ui.note(_("calling hook %s: %s\n") % (hname, funcname)) - starttime = time.time() + starttime = util.timer() try: r = obj(ui=ui, repo=repo, hooktype=name, **args) @@ -106,7 +105,7 @@ ui.traceback() return True, True finally: - duration = time.time() - starttime + duration = util.timer() - starttime ui.log('pythonhook', 'pythonhook-%s: %s finished in %0.2f seconds\n', name, funcname, duration) if r: @@ -118,7 +117,7 @@ def _exthook(ui, repo, name, cmd, args, throw): ui.note(_("running hook %s: %s\n") % (name, cmd)) - starttime = time.time() + starttime = util.timer() env = {} # make in-memory changes visible to external process @@ -145,7 +144,7 @@ cwd = pycompat.getcwd() r = ui.system(cmd, environ=env, cwd=cwd) - duration = time.time() - starttime + duration = util.timer() - starttime ui.log('exthook', 'exthook-%s: %s finished in %0.2f seconds\n', name, cmd, duration) if r: