Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/kernel/bootstrap/stat.rb b/kernel/bootstrap/stat.rb
- index 61cf3d8..b3a51c2 100644
- --- a/kernel/bootstrap/stat.rb
- +++ b/kernel/bootstrap/stat.rb
- @@ -87,6 +87,11 @@ module Rubinius
- raise PrimitiveFailure, "Rubinius::Stat#ctime primitive failed"
- end
- + def birthtime
- + Rubinius.primitive :stat_birthtime
- + raise NotImplementedError, "birthtime() function is unimplemented on this machine"
- + end
- +
- def inspect
- "#<#{self.class.name} dev=0x#{self.dev.to_s(16)}, ino=#{self.ino}, " \
- "mode=#{sprintf("%07d", self.mode.to_s(8).to_i)}, nlink=#{self.nlink}, " \
- diff --git a/kernel/common/file.rb b/kernel/common/file.rb
- index fca8498..465a505 100644
- --- a/kernel/common/file.rb
- +++ b/kernel/common/file.rb
- @@ -104,6 +104,28 @@ class File < IO
- end
- ##
- + # Returns the change time for the named file (the
- + # time at which directory information about the
- + # file was changed, not the file itself).
- + #
- + # File.ctime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003
- + def self.ctime(path)
- + Stat.new(path).ctime
- + end
- +
- + def self.birthtime(path)
- + Stat.new(path).birthtime
- + end
- +
- + ##
- + # Returns the modification time for the named file as a Time object.
- + #
- + # File.mtime("testfile") #=> Tue Apr 08 12:58:04 CDT 2003
- + def self.mtime(path)
- + Stat.new(path).mtime
- + end
- +
- + ##
- # Returns the last component of the filename given
- # in file_name, which must be formed using forward
- # slashes (``/’’) regardless of the separator used
- @@ -305,16 +327,6 @@ class File < IO
- end
- ##
- - # Returns the change time for the named file (the
- - # time at which directory information about the
- - # file was changed, not the file itself).
- - #
- - # File.ctime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003
- - def self.ctime(path)
- - Stat.new(path).ctime
- - end
- -
- - ##
- # Returns true if the named file is a directory, false otherwise.
- #
- # File.directory?(".")
- @@ -816,14 +828,6 @@ class File < IO
- Stat.lstat path
- end
- - ##
- - # Returns the modification time for the named file as a Time object.
- - #
- - # File.mtime("testfile") #=> Tue Apr 08 12:58:04 CDT 2003
- - def self.mtime(path)
- - Stat.new(path).mtime
- - end
- -
- def self.path(obj)
- return obj.to_path if obj.respond_to? :to_path
- @@ -1226,6 +1230,18 @@ class File < IO
- Stat.new(@path).atime
- end
- + def ctime
- + Stat.new(@path).ctime
- + end
- +
- + def birthtime
- + Stat.new(@path).birthtime
- + end
- +
- + def mtime
- + Stat.new(@path).mtime
- + end
- +
- def reopen(other, mode = 'r+')
- rewind unless closed?
- unless other.kind_of? IO
- @@ -1234,10 +1250,6 @@ class File < IO
- super(other, mode)
- end
- - def ctime
- - Stat.new(@path).ctime
- - end
- -
- def flock(const)
- const = Rubinius::Type.coerce_to const, Integer, :to_int
- @@ -1251,10 +1263,6 @@ class File < IO
- Stat.lstat @path
- end
- - def mtime
- - Stat.new(@path).mtime
- - end
- -
- def stat
- Stat.fstat @descriptor
- end
- diff --git a/vm/builtin/stat.cpp b/vm/builtin/stat.cpp
- index 2bff56b..8c9ecd5 100644
- --- a/vm/builtin/stat.cpp
- +++ b/vm/builtin/stat.cpp
- @@ -77,5 +77,9 @@ namespace rubinius {
- return Time::at(state, st_.st_ctime);
- }
- + Time* Stat::stat_birthtime(STATE) {
- + return Time::at(state, st_.st_birthtime);
- + }
- +
- }
- diff --git a/vm/builtin/stat.hpp b/vm/builtin/stat.hpp
- index dd17723..e7735b1 100644
- --- a/vm/builtin/stat.hpp
- +++ b/vm/builtin/stat.hpp
- @@ -73,6 +73,9 @@ namespace rubinius {
- // Rubinius.primitive+ :stat_ctime
- Time* stat_ctime(STATE);
- + // Rubinius.primitive+ :stat_birthtime
- + Time* stat_birthtime(STATE);
- +
- class Info : public TypeInfo {
- public:
- BASIC_TYPEINFO(TypeInfo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement