Skip to content

Commit 2f71af4

Browse files
committed
Calculate correct FPS
1 parent 2dc14fa commit 2f71af4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

demosys/view/controller.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run(manager=None):
7171
# Main loop
7272
frames, ft = 0, 0
7373
prev_time = TIMER.get_time()
74+
time_start = glfw.get_time()
7475
while not WINDOW.should_close():
7576
# Immediately get control of the current time
7677
t = TIMER.get_time()
@@ -92,10 +93,12 @@ def run(manager=None):
9293
ft = t - prev_time
9394
prev_time = t
9495

95-
duration = TIMER.stop()
96+
duration_timer = TIMER.stop()
97+
duration = glfw.get_time() - time_start
9698
if duration > 0:
9799
fps = round(frames / duration, 2)
98100
print("Duration: {}s rendering {} frames at {} fps".format(duration, frames, fps))
101+
print("Timeline duration:", duration_timer)
99102

100103
# Let the window and context clean itself up
101104

0 commit comments

Comments
 (0)