[Orgmode] Time computation errors

2009-04-07 Thread Francesco Pizzolante
Hi,

Going on in discovering org-mode, I found 2 problems when trying
to make computations on times.

Consider the following example:

--8---cut here---start-8---
* Test
#+COLUMNS: %25ITEM(Description)  %Time1{:} %Time2{:} %Time3{:}

#+BEGIN: columnview :hlines 1 :id local
| 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
#+END:

*** Item 1
:PROPERTIES:
:Time1:-1:30
:Time2:1:00
:END:

*** Item 2
:PROPERTIES:
:Time1:4:00
:Time2:2:00
:END:
--8---cut here---end---8---


Problems:

1) The sum of Time1 for Test headline is wrong: 3:30 instead of
   2: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.

Any feedback is welcome.

Thanks,
Francesco


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Time computation errors

2009-04-07 Thread Daniel Clemente
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


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode