Open wizardion opened 2 years ago
Well, the reason for this caveat is that linux doesn't have a btime
stat, it's not part of the specification at all. If you run the stat
command on a file, you shouldn't see any sort of creation time listed for this reason.
A quick search reveals that the specification allows for additional, non-standard timestamps to files (such as btime) but I'm not sure how it works or whether a creation timestamp would be stored the same way across all linux systems. 🤔
And what about ‘crtime’? I saw some articles on the internet that for the filesystems like ext4 – crtime is supported…
It seems like that's true, but I'm not experienced enough with linux development to know how to set such a timestamp, and research yielded few results. We're currently using utimensat()
which doesn't support btime. I found attempts to add btime to it, but they were largely rejected with reasons such as "btime should be read-only" and it's "inconsistent behavior".
I would welcome a PR as long as it doesn't cause problems on other filesystems or introduce any unexpected behavior, but this is out of scope for me personally.
I saw the "Caveats" in the description, and the
btime
for Linux distros does not support be setting... But for curiosity, is it possible that this feature will be implemented? I'm interested in the "created date" field of a file.Linux distro: Ubuntu server 20.04.