Commits

Christian Kellermann committed 7d81f4d

Switch to sdl-get-ticks for timing information

This is a first attempt to fix jitter in the timing delta, as
current-time's resolution is not sufficient.

Comments (0)

Files changed (1)

 
 (define (event-handler)
   (lambda ()
-    (let ((last (time->seconds (current-time))))
+    (let ((last (sdl-get-ticks)))
       (call-with-current-continuation
        (lambda (escape)
          (let loop ()
-           (let* ((now (time->seconds (current-time)))
+           (let* ((now (sdl-get-ticks))
                   (dt (- now last)))
              (call-with-current-continuation
               (lambda (k)
                     escape)))))
              (show!)
              (set! last now)
-	     (let ((duration (- (time->seconds (current-time)) last)))
+             (let ((duration (- (sdl-get-ticks) last)))
 	       (when (< duration *minimum-wait*)
-		     (thread-sleep! (- *minimum-wait* duration))))
+                 (thread-sleep! (- *minimum-wait* duration))))
              (loop)))))
              (call-with-current-continuation
               (lambda (k)