@@ -171,14 +171,14 @@ async def run(self):
171171 frames = []
172172 start_time = frame_time = system_clock () if self .realtime else 0
173173 last = self .counter .beat_at_time (frame_time )
174- save_state_time = system_clock () + self .STATE_SAVE_PERIOD
174+ save_state_time = frame_time + self .STATE_SAVE_PERIOD
175175 execution = render = housekeeping = 0
176176 slow_frame = False
177177 performance = 1 if self .realtime else 2
178178 gc_pending = False
179179 last_gc = None
180180 run_program = current_program = errors = logs = None
181- simplify_state_time = system_clock () + self .state_simplify_wait
181+ simplify_state_time = frame_time + self .state_simplify_wait
182182 static = dict (self .defined_names )
183183 static .update ({'realtime' : self .realtime , 'screen' : self .screen , 'fullscreen' : self .fullscreen ,
184184 'vsync' : self .vsync , 'offscreen' : self .offscreen , 'opengl_es' : self .opengl_es , 'run_time' : self .run_time })
@@ -206,7 +206,7 @@ async def run(self):
206206 self .state_generation0 ^= self .state_generation1
207207 self .state_generation1 = self .state_generation2
208208 self .state_generation2 = set ()
209- simplify_state_time = system_clock () + self .state_simplify_wait
209+ simplify_state_time = frame_time + self .state_simplify_wait
210210
211211 now = system_clock ()
212212 housekeeping += now
@@ -256,12 +256,12 @@ async def run(self):
256256 logger .debug ("Undo simplification on state; original program with {} instructions" , len (run_program ))
257257 self .state_generation1 ^= self .state_generation2 - generation2to0
258258 self .state_generation2 = set ()
259- simplify_state_time = system_clock () + self .state_simplify_wait
259+ simplify_state_time = frame_time + self .state_simplify_wait
260260 self .global_state_dirty = True
261- self .state_timestamp = system_clock ()
261+ self .state_timestamp = frame_time
262262 self .state .clear_changed ()
263263
264- if self .state_simplify_wait and system_clock () > simplify_state_time :
264+ if self .state_simplify_wait and frame_time > simplify_state_time :
265265 if current_program is not None and self .state_generation1 :
266266 if self .state_generation1 :
267267 self .state_generation2 ^= self .state_generation1
@@ -283,14 +283,14 @@ async def run(self):
283283 len (self .state_generation2 ), len (run_program ), simplify_time * 1000 , compile_time * 1000 )
284284 self .state_generation1 = self .state_generation0
285285 self .state_generation0 = set ()
286- simplify_state_time = system_clock () + self .state_simplify_wait
286+ simplify_state_time = frame_time + self .state_simplify_wait
287287
288- if self .global_state_dirty and self .state_file is not None and system_clock () > save_state_time :
288+ if self .global_state_dirty and self .state_file is not None and frame_time > save_state_time :
289289 logger .trace ("Saving state" )
290290 with open (self .state_file , 'wb' ) as file :
291291 pickle .dump (self .global_state , file )
292292 self .global_state_dirty = False
293- save_state_time = system_clock () + self .STATE_SAVE_PERIOD
293+ save_state_time = frame_time + self .STATE_SAVE_PERIOD
294294
295295 if self .switch_page is not None :
296296 self .switch_to_page (self .switch_page )
0 commit comments