I am using this code to compare times:
(time1.to_i - time2.to_i).abs < 5 The intention is that if two times are measured within 5 seconds from each other, they will be equal. I'm using it to compare updating of records, so 5 seconds is acceptable as a buffer, and stops the code returning false when the records are only splitseconds apart.
Is there a better way to do this?
TimeDifference.between(start_time, end_time).in_years.