unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: sds@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: inverse of float-time?
Date: Tue, 17 Sep 2013 14:10:22 -0700	[thread overview]
Message-ID: <5238C53E.6090102@cs.ucla.edu> (raw)
In-Reply-To: <87hadjdxm2.fsf@gnu.org>

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	other threads:[~2013-09-17 21:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 17:39 inverse of float-time? Sam Steingold
2013-09-11 19:14 ` Paul Eggert
2013-09-11 19:31   ` Sam Steingold
2013-09-12  1:52     ` Leo Liu
2013-09-12  3:44       ` Sam Steingold
2013-09-12  4:16         ` Paul Eggert
2013-09-12 16:30           ` Ulrich Mueller
2013-09-17 20:03           ` Sam Steingold
2013-09-17 21:10             ` Paul Eggert [this message]
2013-09-12  3:07 ` SAKURAI Masashi
2013-09-12  3:42   ` Sam Steingold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5238C53E.6090102@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).