Peter Vandenabeele wrote in post #1041349:
> On Tue, Jan 17, 2012 at 4:37 PM, Peter Vandenabeele
> <peter / vandenabeele.com>wrote:
>
>>> >
>>> Thanks Robert,
>>>
>>> By collect range, how would I say subtract 15 minutes from the current
>>> time so that I can collect all matches from 14:31:02 through 14:46:02?
>>>
>>
>> 1.9.3p0 :006 > Time.now.to_s
>>  => "2012-01-17 16:36:06 +0100"
>> 1.9.3p0 :007 > (Time.now - (15*60)).to_s
>>  => "2012-01-17 16:21:09 +0100"
>>
>
> Actually, for log files, it may be better to use uniform UTC times. So,
> no confusion on summer/winter time or servers in different part of
> the world etc.
>
> 1.9.3p0 :029 > Time.now.utc.to_s
>  => "2012-01-17 15:43:25 UTC"
> 1.9.3p0 :030 > (Time.now - (15*60)).utc.to_s
>  => "2012-01-17 15:28:30 UTC"
>
> HTH,
>
> Peter

Unfortunately I have no control over the format of the logs. I am trying 
to compare the current time to the string value in the logs.
Any ideas on how to get past the crossing midnight issue?

I came up with is for gathering start and end times but the above looks 
nicer.

s_time = Time.now
e_time = s_time - 900

Either way I now have the start time and end time so how would I make a 
range out of that counting in seconds?

Being relatively newb,I still find it amazing that parts f the script I 
think would be the simplest turns out to be the most difficult.

Thanks for the input so far!!!

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