badboy wrote:
> Cyrus Dev schrieb:
>> 
>> thanks in advance
> my first solution would be to put the three time objects in an Array:
>    now = Time.now
>    timebefore = now - 30*60*60
>    timeafter = now + 30*60*60
>    timearray = [now, timebefore, timeafter]
> and after that using
>    timearray.sort
> to sort them. If now is between the two dates if should be on position 1

Or put the time objects in a range.

timeslot = (Time.now+1..Time.now+2)

# use like this:
4.times do
  puts timeslot.include?(Time.now)
  sleep 1
end

hth,

Siep
-- 
Posted via http://www.ruby-forum.com/.