emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Time computation errors


From: Daniel Clemente
Subject: Re: [Orgmode] Time computation errors
Date: Wed, 08 Apr 2009 00:37:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

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=$2+$3

  The problem is that calc (the package used by org-mode to do math 
calculations) sees 3:30 as a fraction: three thirtieths = 3/30 = 1/10 = 0.1

>
> 1) The sum of Time1 for Test headline is wrong: 3:30 instead of
>    2:30;
>
  (-1/30) + (4/30) = (-1+4)/30 = -3/30 → -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 „bad format“ to calc, not 
infinite…).


  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=$2+$3


  (The negative time is however incorrect).

  I think it will be easier to use directly forms like 00:30 or the <2009-04-08 
mié 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




reply via email to

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