emacs-orgmode
[Top][All Lists]

## Re: [O] org table calc and lisp for hh:mm timetable

 From: Eric Schulte Subject: Re: [O] org table calc and lisp for hh:mm timetable Date: Wed, 23 Mar 2011 19:18:43 -0600 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> Hi,
>
> If we're not just looking for a neat workaround for some special cases
> anymore, but looking at making org-tables aware of time-like strings
> by default, a better strategy than to convert them into integers might
> be to translate them into Calc time format and back again.
>
> After all, Calc and hence the Org spreadsheet already handles time
> arithmetic perfectly well, it's just that it would be nice to have
> this functionality with the extra option to enter and display times as
> =12:45= rather than =12@ 45'= or =12h 45m=.
>

I did not realize that calc (and hence Org) already supported operating
on time values.  The =7@ 30'= format does indeed work well for time
table formulas (although the =12h 5m= format does not), e.g.,

| 1@ 20' | 2 | 0@ 40' 0."  |
| 2@ 5'  | 3 | 0@ 41' 40." |
#+TBLFM: \$3=\$1/\$2

Maybe all that is needed is explicit mention of this syntax somewhere in
the table section of the Org-mode manual.

The only remaining reason to support a %d:%d time format is that it is
what I (and I expect most users) would first think of to represent time,
and supporting such a format would allow time calculation in a table to
"just work" -- meaning users could likely manipulate time without having
to first look in the manual for the appropriate Calc format.

However as Carsten mentioned such an automatic translation of e.g.,
=7:20= to =7@ 20'= would be a bit bold, and (as mentioned elsewhere) it
would result in having to make some denomination decisions, namely does
=7:20= convert to =7@ 20'= or =7' 20"=.

For now I've posted my `with-time' macro up to Worg.

Cheers -- Eric