summaryrefslogtreecommitdiff
path: root/test/ruby/test_file.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-23 10:34:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-23 10:34:13 +0000
commitc70edbef91e27c7f1626717bfba002a7433e23d7 (patch)
treec838fb401a1f349996dbc7df5288042a2dd3f2f3 /test/ruby/test_file.rb
parent90fb7538f8247b76c9b7ce36eb13209257d863b5 (diff)
test_file.rb: estimate birthtime
* test/ruby/test_file.rb (test_stat): estimate expected birthtime by pinching. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_file.rb')
-rw-r--r--test/ruby/test_file.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index 6e0930f955..c7cfd777dc 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -312,7 +312,9 @@ class TestFile < Test::Unit::TestCase
end
def test_stat
+ tb = Process.clock_gettime(Process::CLOCK_REALTIME)
file = Tempfile.new("stat")
+ tb = (tb + Process.clock_gettime(Process::CLOCK_REALTIME)) / 2
file.close
path = file.path
@@ -328,7 +330,7 @@ class TestFile < Test::Unit::TestCase
delta = 1
stat = File.stat(path)
if stat.birthtime != stat.ctime
- assert_in_delta t0, stat.birthtime.to_f, delta
+ assert_in_delta tb, stat.birthtime.to_f, delta
end
assert_in_delta t0+2, stat.mtime.to_f, delta
assert_in_delta t0+4, stat.ctime.to_f, delta