Skip to content

Commit

Permalink
Use time.perf_counter() for timing
Browse files Browse the repository at this point in the history
`time.time()` can return a lower value than a previous call if the
system clock has been set back between the two calls.
  • Loading branch information
naglis committed Dec 14, 2023
1 parent 9920d53 commit bb9d1b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cozy/architecture/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
def timing(f):
@functools.wraps(f)
def wrap(*args):
time1 = time.time()
time1 = time.perf_counter()
ret = f(*args)
time2 = time.time()
time2 = time.perf_counter()
log.info('{:s} function took {:.3f} ms'.format(f.__name__, (time2-time1)*1000.0))

return ret
Expand Down

0 comments on commit bb9d1b6

Please sign in to comment.