emacs-devel
[Top][All Lists]
Advanced

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

Re: inverse of float-time?


From: Paul Eggert
Subject: Re: inverse of float-time?
Date: Tue, 17 Sep 2013 14:10:22 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

On 09/17/13 13:03, Sam Steingold wrote:

> float-time should be either deprecated or granted equal rights :-)

It should be deprecated.

float-time is based on assumptions that go back to the Good
Old Days, when time stamps typically were 32-bit signed
integer counts of seconds, possibly with an additional
microseconds count.  Under these assumptions float-time
doesn't lose information on typical platforms with IEEE
doubles, which are just barely large enough.

Nowadays, though, time_t is often 64 bits, and timestamps
are typically nanosecond resolution.  IEEE doubles can't
represent these time stamps without losing information, so
float-time generates results with rounding errors.

If we could assume Guile, I suppose we could represent these modern
time stamps exactly, using fractions.  That may be a good
way to go in the future.  It'd be a lot more convenient than
the current list-of-integers representation.

> So, what is the official use case for float-time?
> When one would use it instead of time-date?

I assume that it was put in to make it convenient to compare
or subtract time stamps, or to add a time stamp to a seconds
count.  (You added float-time back in 2000, so you should
know better than I. :-)  These days, one should use
time-less-p, time-subtract, and time-add, as they shouldn't
have rounding errors.




reply via email to

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