[Fluxus] relativity and time

Dave Griffiths dave at pawfal.org
Wed Sep 5 02:47:16 PDT 2007


If you need the absolute time rather than relative "time since fluxus
started" which (time) has changed to, PLT has current-inexact-milliseconds
which can be used for this:

(define (time) (/ (current-inexact-milliseconds) 1000))

However, subsequent calls to (time) in the same frame will give you
different values, the original fluxus time returned one constant time
value for the whole frame, which is much better for animation.

To emulate this, you can do something like:

(define current-time (/ (current-inexact-milliseconds) 1000))
(define (time) current-time)

(define (update-time)
    (set! current-time (/ (current-inexact-milliseconds) 1000)))

(every-frame (update-time))

I use this in my scripts which use time stamping to communicate with other
apps, and it works fine.

cheers,

dave




More information about the Fluxus mailing list