unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to get hours from hh:mm
@ 2007-06-14 12:38 Cecil Westerhof
  2007-06-14 13:35 ` Pascal Bourguignon
  0 siblings, 1 reply; 14+ messages in thread
From: Cecil Westerhof @ 2007-06-14 12:38 UTC (permalink / raw)
  To: help-gnu-emacs

I have a table in org-mode with time needed to travel from A to B an the
number of km. I would like to get the average speed. How do I convert a
time? For example 0:45 becomes 0.75.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-14 12:38 How to get hours from hh:mm Cecil Westerhof
@ 2007-06-14 13:35 ` Pascal Bourguignon
  2007-06-14 13:57   ` Cecil Westerhof
  0 siblings, 1 reply; 14+ messages in thread
From: Pascal Bourguignon @ 2007-06-14 13:35 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof <dummy@dummy.nl> writes:

> I have a table in org-mode with time needed to travel from A to B an the
> number of km. I would like to get the average speed. How do I convert a
> time? For example 0:45 becomes 0.75.

How do you know that 0:45 becomes 0.75?

How did you do it?


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-14 13:35 ` Pascal Bourguignon
@ 2007-06-14 13:57   ` Cecil Westerhof
  2007-06-14 18:27     ` Pascal Bourguignon
                       ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Cecil Westerhof @ 2007-06-14 13:57 UTC (permalink / raw)
  To: help-gnu-emacs

Pascal Bourguignon wrote:

> Cecil Westerhof <dummy@dummy.nl> writes:
> 
>> I have a table in org-mode with time needed to travel from A to B an the
>> number of km. I would like to get the average speed. How do I convert a
>> time? For example 0:45 becomes 0.75.
> 
> How do you know that 0:45 becomes 0.75?
> 
> How did you do it?

I did not. I want. 0:45 is three quarters of an hour, so in mathematical
notation 0.75.
What I would like:
- the first field contains 90
- the second field contains 0:45, or 00:45
- the third field is computed to 120

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-14 13:57   ` Cecil Westerhof
@ 2007-06-14 18:27     ` Pascal Bourguignon
  2007-06-14 19:06       ` Alexis Roda
       [not found]       ` <mailman.2173.1181847997.32220.help-gnu-emacs@gnu.org>
  2007-06-14 20:15     ` J. David Boyd
       [not found]     ` <mailman.2178.1181852166.32220.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 14+ messages in thread
From: Pascal Bourguignon @ 2007-06-14 18:27 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof <dummy@dummy.nl> writes:

> Pascal Bourguignon wrote:
>
>> Cecil Westerhof <dummy@dummy.nl> writes:
>> 
>>> I have a table in org-mode with time needed to travel from A to B an the
>>> number of km. I would like to get the average speed. How do I convert a
>>> time? For example 0:45 becomes 0.75.
>> 
>> How do you know that 0:45 becomes 0.75?
>> 
>> How did you do it?
>
> I did not. I want. 0:45 is three quarters of an hour, so in mathematical
> notation 0.75.

How do you know that 0:45 is THREE QUARTERS of an hour?
What if it was 0:38 ?  How would you compute it in "mathematical notation"?


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-14 18:27     ` Pascal Bourguignon
@ 2007-06-14 19:06       ` Alexis Roda
       [not found]       ` <mailman.2173.1181847997.32220.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Alexis Roda @ 2007-06-14 19:06 UTC (permalink / raw)
  To: help-gnu-emacs

En/na Pascal Bourguignon ha escrit:
> Cecil Westerhof <dummy@dummy.nl> writes:
> 
>> Pascal Bourguignon wrote:
>>
>>> Cecil Westerhof <dummy@dummy.nl> writes:
>>>
>>>> I have a table in org-mode with time needed to travel from A to B an the
>>>> number of km. I would like to get the average speed. How do I convert a
>>>> time? For example 0:45 becomes 0.75.
>>> How do you know that 0:45 becomes 0.75?
>>>
>>> How did you do it?
>> I did not. I want. 0:45 is three quarters of an hour, so in mathematical
>> notation 0.75.

Something like this could be helpful:

(defun time100(time)
   (let ((timelist (split-string time ":")))
     (+ (string-to-number (car timelist))
        (/ (string-to-number (cadr timelist))
           60.0))))


HTH

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-14 13:57   ` Cecil Westerhof
  2007-06-14 18:27     ` Pascal Bourguignon
@ 2007-06-14 20:15     ` J. David Boyd
       [not found]     ` <mailman.2178.1181852166.32220.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 14+ messages in thread
From: J. David Boyd @ 2007-06-14 20:15 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof <dummy@dummy.nl> writes:

> Pascal Bourguignon wrote:
>
>> Cecil Westerhof <dummy@dummy.nl> writes:
>> 
>>> I have a table in org-mode with time needed to travel from A to B an the
>>> number of km. I would like to get the average speed. How do I convert a
>>> time? For example 0:45 becomes 0.75.
>> 
>> How do you know that 0:45 becomes 0.75?
>> 
>> How did you do it?
>
> I did not. I want. 0:45 is three quarters of an hour, so in mathematical
> notation 0.75.
> What I would like:
> - the first field contains 90
> - the second field contains 0:45, or 00:45
> - the third field is computed to 120

It is based on dividing by 60.

0:45 is 45 minutes, which is 45/60 of an hour.

This becomes .75.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
       [not found]     ` <mailman.2178.1181852166.32220.help-gnu-emacs@gnu.org>
@ 2007-06-15  5:52       ` Pascal Bourguignon
  2007-06-15  6:06         ` cmr.Pent
  0 siblings, 1 reply; 14+ messages in thread
From: Pascal Bourguignon @ 2007-06-15  5:52 UTC (permalink / raw)
  To: help-gnu-emacs

david@adboyd.com (J. David Boyd) writes:

> Cecil Westerhof <dummy@dummy.nl> writes:
>
>> Pascal Bourguignon wrote:
>>
>>> Cecil Westerhof <dummy@dummy.nl> writes:
>>> 
>>>> I have a table in org-mode with time needed to travel from A to B an the
>>>> number of km. I would like to get the average speed. How do I convert a
>>>> time? For example 0:45 becomes 0.75.
>>> 
>>> How do you know that 0:45 becomes 0.75?
>>> 
>>> How did you do it?
>>
>> I did not. I want. 0:45 is three quarters of an hour, so in mathematical
>> notation 0.75.
>> What I would like:
>> - the first field contains 90
>> - the second field contains 0:45, or 00:45
>> - the third field is computed to 120
>
> It is based on dividing by 60.
>
> 0:45 is 45 minutes, which is 45/60 of an hour.
>
> This becomes .75.

You need to unlock Cecil's neurons!  He clearly knows it, but he
doesn't know that he knows it.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-15  5:52       ` Pascal Bourguignon
@ 2007-06-15  6:06         ` cmr.Pent
  0 siblings, 0 replies; 14+ messages in thread
From: cmr.Pent @ 2007-06-15  6:06 UTC (permalink / raw)
  To: help-gnu-emacs

"Unlock Cecil's neurons"
Mana cost 60, cooldown time 30

Removes all negative effects from target and gives it +2 intelligence
for 3 sec. The target should have at least 1 neuron. Can only be cast
on Cecil.

;-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
       [not found]       ` <mailman.2173.1181847997.32220.help-gnu-emacs@gnu.org>
@ 2007-06-16 15:10         ` Cecil Westerhof
  2007-06-16 15:32           ` Cecil Westerhof
                             ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Cecil Westerhof @ 2007-06-16 15:10 UTC (permalink / raw)
  To: help-gnu-emacs

Alexis Roda wrote:
> Something like this could be helpful:
> 
> (defun time100(time)
>    (let ((timelist (split-string time ":")))
>      (+ (string-to-number (car timelist))
>         (/ (string-to-number (cadr timelist))
>            60.0))))

I tried this:

(defun getMinutes(time)
  (interactive "sDuration: ")
  (let ((timelist (split-string time ":")))
    (+ 
      (string-to-number (car timelist))
      (/ 
        (string-to-number (cadr timelist))
        60.0
      )
    )
  )
)

When I dan give M-x getMinutes and on the prompt give: 00:18, I get:
        Symbol's function definition is void: let

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-16 15:10         ` Cecil Westerhof
@ 2007-06-16 15:32           ` Cecil Westerhof
  2007-06-16 15:41           ` Joost Kremers
                             ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Cecil Westerhof @ 2007-06-16 15:32 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof wrote:
> I tried this:
> 
> (defun getMinutes(time)

Wrong name, should be getHours. But not important for the problem.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-16 15:10         ` Cecil Westerhof
  2007-06-16 15:32           ` Cecil Westerhof
@ 2007-06-16 15:41           ` Joost Kremers
  2007-06-16 15:52           ` David Kastrup
  2007-06-16 16:16           ` Stephen Berman
  3 siblings, 0 replies; 14+ messages in thread
From: Joost Kremers @ 2007-06-16 15:41 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof wrote:
[...]
>   (let ((timelist (split-string time ":")))
[...]
>
> When I dan give M-x getMinutes and on the prompt give: 00:18, I get:
>         Symbol's function definition is void: let

most likely because there's a hard space after let. at least there is when
i reply to your message.


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-16 15:10         ` Cecil Westerhof
  2007-06-16 15:32           ` Cecil Westerhof
  2007-06-16 15:41           ` Joost Kremers
@ 2007-06-16 15:52           ` David Kastrup
  2007-06-16 17:28             ` Cecil Westerhof
  2007-06-16 16:16           ` Stephen Berman
  3 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2007-06-16 15:52 UTC (permalink / raw)
  To: help-gnu-emacs

Cecil Westerhof <dummy@dummy.nl> writes:

> Alexis Roda wrote:
>> Something like this could be helpful:
>> 
>> (defun time100(time)
>>    (let ((timelist (split-string time ":")))
>>      (+ (string-to-number (car timelist))
>>         (/ (string-to-number (cadr timelist))
>>            60.0))))
>
> I tried this:
>
> (defun getMinutes(time)
>   (interactive "sDuration: ")
>   (let ((timelist (split-string time ":")))
>     (+ 
>       (string-to-number (car timelist))
>       (/ 
>         (string-to-number (cadr timelist))
>         60.0
>       )
>     )
>   )
> )
>
> When I dan give M-x getMinutes and on the prompt give: 00:18, I get:
>         Symbol's function definition is void: let

Never cut&paste code from articles with KNode.  It randomly peppers
material with non-breakable spaces.

Get a real newsreader, like Gnus.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-16 15:10         ` Cecil Westerhof
                             ` (2 preceding siblings ...)
  2007-06-16 15:52           ` David Kastrup
@ 2007-06-16 16:16           ` Stephen Berman
  3 siblings, 0 replies; 14+ messages in thread
From: Stephen Berman @ 2007-06-16 16:16 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, 16 Jun 2007 17:10:48 +0200 Cecil Westerhof <dummy@dummy.nl> wrote:

> Alexis Roda wrote:
>> Something like this could be helpful:
>> 
>> (defun time100(time)
>>    (let ((timelist (split-string time ":")))
>>      (+ (string-to-number (car timelist))
>>         (/ (string-to-number (cadr timelist))
>>            60.0))))
>
> I tried this:
>
> (defun getMinutes(time)
>   (interactive "sDuration: ")
>   (let ((timelist (split-string time ":")))
>     (+ 
>       (string-to-number (car timelist))
>       (/ 
>         (string-to-number (cadr timelist))
>         60.0
>       )
>     )
>   )
> )
>
> When I dan give M-x getMinutes and on the prompt give: 00:18, I get:
>         Symbol's function definition is void: let

Somehow your version contains nobreak space characters starting right
after `let'.  If you change all of those to normal space characters,
the function works fine.

Steve Berman

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to get hours from hh:mm
  2007-06-16 15:52           ` David Kastrup
@ 2007-06-16 17:28             ` Cecil Westerhof
  0 siblings, 0 replies; 14+ messages in thread
From: Cecil Westerhof @ 2007-06-16 17:28 UTC (permalink / raw)
  To: help-gnu-emacs

David Kastrup wrote:
> Never cut&paste code from articles with KNode.  It randomly peppers
> material with non-breakable spaces.

Not nice. :-{
That was the problem. And it was also at another place.

Maybe I should upgrade to Emacs 22.


> Get a real newsreader, like Gnus.

Is on my todo list.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-06-16 17:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-14 12:38 How to get hours from hh:mm Cecil Westerhof
2007-06-14 13:35 ` Pascal Bourguignon
2007-06-14 13:57   ` Cecil Westerhof
2007-06-14 18:27     ` Pascal Bourguignon
2007-06-14 19:06       ` Alexis Roda
     [not found]       ` <mailman.2173.1181847997.32220.help-gnu-emacs@gnu.org>
2007-06-16 15:10         ` Cecil Westerhof
2007-06-16 15:32           ` Cecil Westerhof
2007-06-16 15:41           ` Joost Kremers
2007-06-16 15:52           ` David Kastrup
2007-06-16 17:28             ` Cecil Westerhof
2007-06-16 16:16           ` Stephen Berman
2007-06-14 20:15     ` J. David Boyd
     [not found]     ` <mailman.2178.1181852166.32220.help-gnu-emacs@gnu.org>
2007-06-15  5:52       ` Pascal Bourguignon
2007-06-15  6:06         ` cmr.Pent

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).