Skip to content

Commit

Permalink
Use monotonic_ns
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Sep 18, 2024
1 parent 685fc41 commit df6e586
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/calibre/gui2/viewer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


import sys
from time import monotonic
from time import monotonic_ns

from calibre.constants import DEBUG

Expand Down Expand Up @@ -60,15 +60,15 @@ def url_for_book_in_library():
class PerformanceMonitor:

def __init__(self):
self.start_time = monotonic()
self.start_time = monotonic_ns()

def __call__(self, desc='', reset=False):
if DEBUG:
at = monotonic()
at = monotonic_ns()
if reset:
self.start_time = at
if desc:
ts = at - self.start_time
ts = (at - self.start_time) / 1e9
print(f'[{ts:.3f}] {desc}', file=sys.stderr)


Expand Down

0 comments on commit df6e586

Please sign in to comment.