From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Clemente Subject: Re: Time computation errors Date: Wed, 08 Apr 2009 00:37:55 +0200 Message-ID: <87ocv8dr98.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LrJvE-0006ot-7q for emacs-orgmode@gnu.org; Tue, 07 Apr 2009 18:37:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LrJv9-0006mY-MZ for emacs-orgmode@gnu.org; Tue, 07 Apr 2009 18:37:35 -0400 Received: from [199.232.76.173] (port=50915 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrJv9-0006mQ-GK for emacs-orgmode@gnu.org; Tue, 07 Apr 2009 18:37:31 -0400 Received: from mail-fx0-f166.google.com ([209.85.220.166]:58618) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LrJv9-0008DR-1M for emacs-orgmode@gnu.org; Tue, 07 Apr 2009 18:37:31 -0400 Received: by fxm10 with SMTP id 10so2906628fxm.42 for ; Tue, 07 Apr 2009 15:37:30 -0700 (PDT) In-Reply-To: (Francesco Pizzolante's message of "Tue, 07 Apr 2009 14:29:21 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Francesco Pizzolante Cc: mailing-list-org-mode El mar, abr 07 2009, Francesco Pizzolante va escriure: > Consider the following example: > > | Description | Time1 | Time2 | Time3 | > |-------------+-------+-------+--------| > | * Test | 3:30 | 3:00 | #ERROR | > | *** Item 1 | -1:30 | 1:00 | #ERROR | > | *** Item 2 | 4:00 | 2:00 | #ERROR | > #+TBLFM: $4=3D$2+$3 The problem is that calc (the package used by org-mode to do math calcula= tions) sees 3:30 as a fraction: three thirtieths =3D 3/30 =3D 1/10 =3D 0.1 > > 1) The sum of Time1 for Test headline is wrong: 3:30 instead of > 2:30; > (-1/30) + (4/30) =3D (-1+4)/30 =3D -3/30 =E2=86=92 -3:30 > 2) I'm unable to sum times through a formula (see Time3 column). > The same formula works perfectly when you replace times with > integers. > 3:00 is 3/0 and gives an error (as a fraction it is =E2=80=9Ebad format= =E2=80=9C to calc, not infinite=E2=80=A6). You can do more tests with: M-x calc RET According to the Calc manual: The default format for HMS values is `hours@ mins' secs"'. So this makes calc happy: | Description | Time1 | Time2 | Time3 | |-------------+---------+--------+-------------| | * Test | 3@ 30' | 3@ 00' | 6@ 30' 0" | | *** Item 1 | -1@ 30' | 1@ 00' | -1@ -30' 0" | | *** Item 2 | 4@ 00' | 2@ 00' | 6@ 0' 0" | #+TBLFM: $4=3D$2+$3 (The negative time is however incorrect). I think it will be easier to use directly forms like 00:30 or the <2009-0= 4-08 mi=C3=A9 00:33> from org-mode, and make your own functions from there. Anyway, org tracks more times and dates than fractions, so 00:30 could be= also understood by org as a time. -- Daniel