>>>>> "Jay" == Jay Savage <[EMAIL PROTECTED]> writes:

Jay> It depends on what you mean by "creation". stat() on POSIXish systems
Jay> returns ctime, which is the inode creation time,

Nope.  Inode *change* time.  Will update any time you write to the
file, or change any metadata (owner, permissions, number of links
[including renaming], other timestamps).

Jay>  which is the time the
Jay> physical location on disk was first written to (actually, these days
Jay> it's the time the vnode was fist written to, but you don't really care
Jay> that much about disk geometry, do you?). The time will not be
Jay> preserved across relocations (i.e. mv and cp will destroy it),
Jay> although many archivers reinstate the file's original ctime when files
Jay> are restored from backup.

This is not possible at a user-level.  You can set atime and mtime from
a system call, but not ctime.  ctime is always set to "now".

Jay>  For most applications, though, "when this
Jay> particular disk space was reserved for data" is an effective synonym
Jay> for "when this file was created. When you start moving files around,
Jay> the questions merlyn raises become much more important.

Jay> For the record, Kirk McKusick--one of the original implemetors of
Jay> UFS/FFS and the creator of UFS2--tells the story a little differently.
Jay>  According to him, the FFS originally intended to use ctime as the
Jay> creation time, but they discovered that dump needed a record of inode
Jay> creation to make incrimental backups effectively. In fact, UFS2
Jay> includes a btime (call it "birth time" if you want) field that is
Jay> stable across inode relocations when the system uses btime aware file
Jay> system operations. I don't know, though, if the Perl team has plans to
Jay> update stat() to support it on systems where it is available.

Jay> Of course, that isn't completely at odds with merlyn's comments: the
Jay> original unix developers started implementing file systems a decade
Jay> before Berkely started work on FFS.

And, the whole notion of "creation time" doesn't make sense in the
first place.  If I add a word, is it a new file, or an old file?  If I
gut the entire contents, replace it with entirely new contents, is it
new or old?  What if I rename it?  Is it new, or old?  There are no
consistent answers to any of those questions, so why bother?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to