From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#11825: 24.1.50; float-time no longer accepts negative time values Date: Sun, 08 Jul 2012 18:32:50 +0300 Message-ID: <83pq86l13x.fsf@gnu.org> References: <4FF79ADD.8080601@cs.ucla.edu> <83r4so12ja.fsf@gnu.org> <4FF89C4C.6060503@cs.ucla.edu> <83wr2fklhs.fsf@gnu.org> <4FF93637.6060304@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1341761641 30836 80.91.229.3 (8 Jul 2012 15:34:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 8 Jul 2012 15:34:01 +0000 (UTC) Cc: 11825@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 08 17:34:00 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SntUk-0005HE-E1 for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2012 17:33:58 +0200 Original-Received: from localhost ([::1]:58184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SntUj-0004XQ-EP for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2012 11:33:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SntUg-0004XL-LC for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2012 11:33:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SntUe-0003Li-Mk for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2012 11:33:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SntUe-0003Le-JP for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2012 11:33:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SntZd-0003uE-Up for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2012 11:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jul 2012 15:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11825 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11825-submit@debbugs.gnu.org id=B11825.134176189714960 (code B ref 11825); Sun, 08 Jul 2012 15:39:01 +0000 Original-Received: (at 11825) by debbugs.gnu.org; 8 Jul 2012 15:38:17 +0000 Original-Received: from localhost ([127.0.0.1]:56823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SntYu-0003tF-Kq for submit@debbugs.gnu.org; Sun, 08 Jul 2012 11:38:16 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:38167) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SntYr-0003t5-S1 for 11825@debbugs.gnu.org; Sun, 08 Jul 2012 11:38:15 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M6U00300LEP5O00@a-mtaout22.012.net.il> for 11825@debbugs.gnu.org; Sun, 08 Jul 2012 18:33:01 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M6U003ODLV18C10@a-mtaout22.012.net.il>; Sun, 08 Jul 2012 18:33:01 +0300 (IDT) In-reply-to: <4FF93637.6060304@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61722 Archived-At: > Date: Sun, 08 Jul 2012 00:26:47 -0700 > From: Paul Eggert > CC: 11825@debbugs.gnu.org > > On 07/07/2012 07:57 PM, Eli Zaretskii wrote: > > are you saying that a time difference can > > never be negative on such platforms? > > Yes, that's right. > > > What about the case tv_sec = 0 > > in both time values and tv_nsec difference is negative? > > In that case, timespec_sub returns the > minimum possible time value, namely zero, > since time_t is unsigned. ??? Really??? Then using these facilities safely and portably will be extremely inconvenient. E.g., to express something like T1 = T2 + T3 - T4 instead of a simple t1 = timespec_add (t2, timespec_sub (t3, t4)); one would need something like if (timespec_cmp (t3, t4) < 0) { struct timespec tem1 = timespec_sub (t4, t3); if (timespec_cmp (t2, tem1) < 0) /* error -- no way to express negative time */ else t1 = timespec_sub (t2, tem1); } else t1 = timespec_add (t2, timespec_sub (t3, t4); Am I missing something? If I'm right, and if there's no way to get better facilities, then at the very least this should be prominently explained in systime.h. Right now, this comment, for example: /* Put into DEST the result of adding SRC1 to SRC2, or of subtracting SRC2 from SRC1. On overflow, store an extremal value. */ doesn't come anywhere close to a hint that "an extremal value" could mean zero when SRC1 < SRC2. It's very easy to write buggy code without a clear understanding of this fact, and never find those bugs in testing, if the system happens to use a signed type for time_t.