OSDN Git Service

* [shogi-server] - shogi_server/league/floodgate_thread.rb: Added a log message.
[shogi-server/shogi-server.git] / sample / check_file.rb
1 fname = File.join("/", "tmp", "test.txt")
2 if File.exist?(fname)
3   File.rename(fname, fname+".rename")
4 end
5
6 10000.times do 
7   time = Time.now
8   File.new(fname, File::CREAT)
9   mtime = File.stat(fname).mtime
10   if mtime.to_i < time.to_i
11     date = `/bin/date -R`
12     p time
13     p mtime
14     p date
15     puts "time:  %d.%d" % [time.sec,   time.usec]
16     puts "mtime: %d.%d" % [mtime.sec, mtime.usec]
17     exit 1
18   end
19   File.delete fname
20 end
21