[Top][All Lists]

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

bug#11825: 24.1.50; float-time no longer accepts negative time values

From: Eli Zaretskii
Subject: bug#11825: 24.1.50; float-time no longer accepts negative time values
Date: Mon, 09 Jul 2012 05:56:21 +0300

> Date: Sun, 08 Jul 2012 16:03:39 -0700
> From: Paul Eggert <address@hidden>
> CC: Eli Zaretskii <address@hidden>, address@hidden
> On 07/08/2012 02:00 AM, Andreas Schwab wrote:
> > A difference between two timestamps is always signed.
> No, not if A is an absolute time, and B is a (nonnegative) offset.
> The result is an absolute time, and is unsigned if A was unsigned.
> For example:
>          EMACS_GET_TIME (t);
>          EMACS_SUB_TIME (old, t, EMACS_TIME_FROM_DOUBLE (delay));
> This is a common way that EMACS_SUB_TIME is used in Emacs.

Again, if this facility is limited to this paradigm, I think we should
clearly document that.  The name EMACS_SUB_TIME doesn't tell anything
about that, it certainly sounds like providing a general-purpose
arithmetics on time values.

Anyway, Emacs does subtract absolute time values, at least in Lisp;
see time-subtract.  The current issue started when the result of
time-subtract was passed to float-time, so indirectly such time
differences can sneak into C from Lisp and be handed to these
functions.  And since time-subtract is called by timers, it is very
easy to get into a situation where EMACS_SUB_TIME etc. are used with
second argument not an offset, but an absolute time.

> > this should be prominently explained in systime.h.
> OK, sure, I pushed this:


reply via email to

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