emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daniel Clemente <n142857@gmail.com>
To: Francesco Pizzolante <fpz@missioncriticalit.com>
Cc: mailing-list-org-mode <emacs-orgmode@gnu.org>
Subject: Re: Time computation errors
Date: Wed, 08 Apr 2009 00:37:55 +0200	[thread overview]
Message-ID: <87ocv8dr98.fsf@gmail.com> (raw)
In-Reply-To: <u63hg62rd.fsf@missioncriticalit.com> (Francesco Pizzolante's message of "Tue, 07 Apr 2009 14:29:21 +0200")

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

      parent reply	other threads:[~2009-04-07 22:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07 12:29 Time computation errors Francesco Pizzolante
2009-04-07 13:24 ` Bernt Hansen
     [not found]   ` <87skkktx4n.fsf-EZCVE/ZCkfKiJtKbxSCZYZ53EReGIhmS@public.gmane.org>
2009-04-07 14:12     ` Francesco Pizzolante
2009-04-07 15:32       ` Bernt Hansen
     [not found]         ` <87d4botr7v.fsf-EZCVE/ZCkfKiJtKbxSCZYZ53EReGIhmS@public.gmane.org>
2009-04-08  6:46           ` Francesco Pizzolante
2009-04-08 14:48             ` Bernt Hansen
2009-04-07 22:37 ` Daniel Clemente [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ocv8dr98.fsf@gmail.com \
    --to=n142857@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=fpz@missioncriticalit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).