On Wed, Jun 9, 2010 at 7:34 PM, Clay H. <cchea...@gmail.com> wrote:
> 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.

It's the proportion of a 24 hour day, so 1/48 is a half hour.

But since you're using rails and have active support you could do

if (current - 10.minutes) > previous
  ....

HTH


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

-- 
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.

Reply via email to