chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] srfi-19 time, flonums and s11n


From: Shawn Rutledge
Subject: Re: [Chicken-users] srfi-19 time, flonums and s11n
Date: Mon, 3 Sep 2007 13:15:47 -0700

On 9/3/07, Shawn Rutledge <address@hidden> wrote:
> On 9/3/07, John Cowan <address@hidden> wrote:
> > So go with the flonums; they're simpler.
>
> If I take that approach maybe it makes more sense to use srfi-18 time
> objects.  They consist of only a single flonum, right?  rather than

>From using it, it looks like that's how it is, but it's not.

(define (seconds->time n)
  (##sys#check-number n 'seconds->time)
  (let* ([n2 (max 0 (- n C_startup_time_seconds))] ; seconds since startup
         [ms (truncate (* 1000 (##sys#flonum-fraction
(##sys#exact->inexact n))))] ; milliseconds
         [n3 (inexact->exact (truncate (+ (* n2 1000) ms)))] ) ;
milliseconds since startup
    (##sys#make-structure 'time n3 (truncate n) (inexact->exact ms)) ) )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]