From: Matthew Smillie Date: 2006-06-10T11:09:36+09:00 Subject: Re: Comparing times? On Jun 10, 2006, at 1:10, Eric Armstrong wrote: > On a related subject, when Ruby gives me > a File time, is it to the nearest second, > millisecond, or what, or is it O/S dependent? File#mtime and other File time methods return a normal Time object, which is O/S dependent but can be conveniently treated as a number of seconds. > The goal, of course, is to compare times > on two files to see if they are no more > than a second apart... file_a = File.new("somefile") file_b = File.new("someotherfile") (file_a.mtime - file_b.mtime).abs < 1 ? puts "close" : puts "not close enough" matthew smillie.