From: kosaki.motohiro@... Date: 2014-03-17T20:39:52+00:00 Subject: [ruby-dev:48051] [ruby-trunk - Feature #9647] File::Stat#birthtimeの追加 Issue #9647 has been updated by Motohiro KOSAKI. 更に雑談をつづけてしまうと Windowsには file system tunnelling という機能があり、われわれが birthtimeという文脈で 話すファイル作成日とは若干セマンティクスが違う http://stackoverflow.com/questions/661977/why-windows-sets-new-created-files-created-time-property-to-old-time ので、名前が birthtime でいいかどうか Windows方面の人の意見を聞いたほうがいいかもしれない。 ところで、昔LKMLでだれかからWindowsはctimeのほかにユーザが自由に時刻をいじれない真のファイル作成日も媒体に 記録されていると聞いた記憶があったのだが、簡単にぐぐった限りではそんな情報はみあたらなかった。だれかそのへん 詳しい人がいたら教えていただけると助かります。 ---------------------------------------- Feature #9647: File::Stat#birthtimeの追加 https://bugs.ruby-lang.org/issues/9647#change-45849 * Author: Yui NARUSE * Status: Assigned * Priority: Normal * Assignee: Yukihiro Matsumoto * Category: core * Target version: ---------------------------------------- File::Stat#birthtimeを追加しませんか。 以下の様なシステムの stat(2) には st_birthtimespec があり、 (ctime = change time ではなく) ファイルを作成した日時を得ることができます。 http://netbsd.gw.com/cgi-bin/man-cgi?stat+2+NetBSD-current http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2&apropos=0&manpath=FreeBSD+10.0-RELEASE https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/stat.2.html また、Windowsはbirthtimeがあるがctimeがないという環境ですので、birthtimeはctimeを返します。 http://msdn.microsoft.com/ja-jp/library/ms350241(v=vs.71).aspx 今回のパッチではLinuxやOpenBSDなど、struct statにbirthtimeがない環境では、 Windows同様ctimeを返すようにしています。 (が、意味が違うからWindows以外ではNotImpErrorの方がいいかも) https://github.com/nurse/ruby/compare/ruby:trunk...birthtime -- httsp://bugs.ruby-lang.org/