I just finished debugging ��a production server that had a��similar��issue.��Basically��I need to select from a collection all events that were opening in the next 24 hours. I have code like :-

hours := (each eventOpenTime - timeNow) hours.��
hours between: 0 and: 24.��

I thought this was working before, but debugging the server today, I saw that every event was between 0:23. The #hours message only returned the hours portion of a time, not the amount of hours. I had to change the code to :-

hours := (((each eventOpenTIme - timeNow) asSeconds) / 60 / 60) asInteger.

Anyhow, I guess the name was misleading to me, as there is no #asHours message, but these is #asSeconds, and an #hours and #minutes, but no #seconds.��

��
On Fri, Mar 11, 2011 at 14:04, <pharo@googlecode.com> wrote:

Comment #5 on issue 3806 by cesar.ra...@gmail.com: Duration>>hours is broken While I can second Sebastians' complains based in intuitivity, I got confused with the redaction of the ANSI standard, which I have only a 1.9 Draft in PDF form:

5.8.2.11 Message: hours
Synopsis
Answer the number of complete hours in the receiver.
Definition: <Duration>
Answer an <integer> between -23 and 23 inclusive that represents the number of complete hours
in the receiver, after the number of complete days has been removed. If the receiver is less than
<Duration factory> #zero then the result will be less than or equal to 0.
Return Values
<integer> unspecified
Errors
None

This text seems to support the implementation of the method which is attempting to give the number of fractional part of the duration. It does not seem to be a conversion protocol, but rather an equivalent to the mod operation for hours, or seconds or whatever.

Test this:

(DateAndTime now - DateAndTime today) hours.

In my image, at the time I tested it gave a correct "16".








--
~JT