diff options
Diffstat (limited to 'simulation.scm')
-rw-r--r-- | simulation.scm | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/simulation.scm b/simulation.scm index 6728c42..938500d 100644 --- a/simulation.scm +++ b/simulation.scm @@ -48,13 +48,18 @@ (let ((msg (get-message *output-channel*))) (display msg)))) +(define (time->milliseconds time) + (let* ((seconds (car time)) + (micros (cdr time))) + (+ (* 1000 seconds) (round (/ micros 1000))))) +(define %start-time (time->milliseconds (gettimeofday))) (define (ll f . data) - (let ((now (gettimeofday))) - (spawn-fiber - (lambda () - (put-message - *output-channel* - (format #f "~d~6'0d - ~?~%" (car now) (cdr now) f data)))))) + (spawn-fiber + (lambda () + (put-message + *output-channel* + (format #f "~12'0d - ~?~%" (- (time->milliseconds (gettimeofday)) + %start-time) f data))))) ;; Synchronized id generator (define *id-channel-in* (make-channel)) |