Hi Clay,
On Wed, Jun 9, 2010 at 6:34 PM, Clay H. <cchea...@gmail.com> wrote: > I'm thinking to loop through the file and convert each time stamp to a > DateTime with something like: > ... > require 'date' > ... > previous = DateTime.strptime(thefile[i-1][1], "%m/%d/%Y %H:%M") > current = DateTime.strptime(thefile[i][1], "%m/%d/%Y %H:%M") > ... > > I then could do something like: > diff = current - previous > > and check to see whether diff is greater than 10 minutes -- if so, > then do the processing that I need to do. There are probably more clever solutions but, bein' me, I'd try something simple like... > previous = DateTime.strptime(thefile[i-1][1], "%m/%d/%Y %H:%M") > current = DateTime.strptime(thefile[i][1], "%m/%d/%Y %H:%M") limit = previous.advance(:minutes => 10) if current > limit ... HTH, Bill -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.