End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
File::Stat#birthtime
stat.birthtime → aTime
file.c
View on GitHub ↗
static VALUE
rb_stat_birthtime(VALUE self)
{
return stat_birthtime(get_stat(self));
}
Returns the birth time for stat.
If the platform doesn’t have birthtime, raises NotImplementedError.
Example
File.write("testfile", "foo") sleep 10 File.write("testfile", "bar") sleep 10 File.chmod(0644, "testfile") sleep 10 File.read("testfile") File.stat("testfile").birthtime #=> 2014-02-24 11:19:17 +0900 File.stat("testfile").mtime #=> 2014-02-24 11:19:27 +0900 File.stat("testfile").ctime #=> 2014-02-24 11:19:37 +0900 File.stat("testfile").atime #=> 2014-02-24 11:19:47 +0900