I have ~ 200,000 rows in a csv file that I need to parse. They are time stamped and are supposed to all be 10 minutes apart from each other. The format of the file is: ... 1,05/31/2006 18:08,101 1,05/31/2006 18:18,102 1,05/31/2006 18:28,103 1,05/31/2006 18:38,101 1,05/31/2006 18:48,101 1,05/31/2006 18:58,100 ...
I need to iterate through all of these and mark the ones that have more than 10 minutes between them. 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. It appears that diff returns as something like Rational(1, 48). I'm not sure what to do with that. Any suggestions on how to move forward with this and check for the 10 minute gap? -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

