[Top][All Lists]
[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 01:20:43 -0700 |
On 9/3/07, John Cowan <address@hidden> wrote:
> Shawn Rutledge scripsit:
>
> > Unix timestamps are annoying in Scheme because nowadays they take up
> > most of a 32-bit unsigned int, so it won't fit in a fixnum. If I want
> > to pass a timeval from a C function to Scheme, I see that the
> > unsigned-integer32 datatype gets converted to a flonum by default:
>
> True, but that's not a problem except on oddball hardware. Nowadays,
Which includes ARMs, right?
> flonums are just as fast as ints on typical CPUs, sometimes faster.
> And you don't have to worry about inaccuracies: IEEE double floats
> serve as perfectly good fixnums up through 2^53. It's true that
A double being a 64-bit number, right?
> Chicken boxes all floats, so you have some extra memory and
> manipulation costs, but for timestamps accurate to only 1 second,
> that shouldn't matter much either.
>
> So go with the flonums; they're simpler.
Maybe you're right.
After I read a bit deeper in the SRFI I see that "monotonic" time can
have an implementation-dependent representation. So I think it should
be legal to modify the implementation to use seconds since 2000 for
that type of time, as long as converter functions like
time-monotonic->time-utc work correctly. In the current
implementation monotonic seems the same as UTC as far as I can tell.
Re: [Chicken-users] srfi-19 time, flonums and s11n, Shawn Rutledge, 2007/09/03
Re: [Chicken-users] srfi-19 time, flonums and s11n, john, 2007/09/03
Re: [Chicken-users] srfi-19 time, flonums and s11n, felix winkelmann, 2007/09/03