instance method
File::Stat#birthtime
() -> ::Time
stat.birthtime → time
file.c
View on GitHub ↗
static VALUE
rb_stat_birthtime(VALUE self)
{
return statx_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
Ruby version changes
-
4.0
-
File::Stat#birthtimeis now available on Linux via the statx system call when supported by the kernel and filesystem. [Feature #21205]
-