David Vallner
1/11/2006 11:41:00 PM
misiek wrote:
> David Vallner wrote:
>
>> misiek wrote:
>>
>>> Jules Jacobs wrote:
>>>
>>>> Time.now.beginning_of_day returns the beginning of today. But
>>>> that's probably not what you want because this:
>>>>
>>>> Time.now < Time.now.beginning_of_day
>>>>
>>> thank you , this is exactly what I want
>>>
>> Mind you, it's pretty much always later than it was when the day
>> started. *wonders if misiek is hacking Ruby in a temporal anomaly*
>>
>> David Vallner
>>
>>
>
> better now ? Time.now > Time.now.beginning_of_day
>
I don't know what you're trying to achieve here. ``Time.now >
Time.now.beginning_of_day'' is false for one microsecond each day at
midnight. You shouldn't really have to check for that, it's pretty much
the same as writing ``if true''. Numerical methods coming to mind, you
might instead want to check if the difference between Time.now and
Time.now.beginnning_of_day is less than a given time period.
David Vallner