Skip to content

Commit 408260d

Browse files
use monotonically increasing time if available for undo time estimate
1 parent 7b19699 commit 408260d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bpython/repl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@
5757
class RuntimeTimer(object):
5858
def __init__(self):
5959
self.reset_timer()
60+
self.time = time.monotonic if hasattr(time, 'monotonic') else time.time
6061

6162
def __enter__(self):
62-
self.start = time.time()
63+
self.start = self.time()
6364

6465
def __exit__(self, ty, val, tb):
65-
self.last_command = time.time() - self.start
66+
self.last_command = self.time() - self.start
6667
self.running_time += self.last_command
6768
return False
6869

0 commit comments

Comments
 (0)