I have read that Unix systems has not specified btime or generally like POSIX, there is no specification about btime. There is a mention about btime.

Therefore the question, how should btime be specified or does it not matter and btime can be set whatever the user wants? Should btime be specified? If so, there are already proposals to add it to POSIX or the successor to POSIX. It would be good if someone can tell me where I can send a proposal.

  • ZFS implements crtime and is widely supported. – schily May 27 at 9:27

I’m assuming that by “btime”, you mean “birth time”, or “file creation time”. You’re right, POSIX doesn’t specify that currently, and there is no mention of “btime” in the standard, even in the current 202x draft. It does mention “file creation time”, once, in relation to pax.

As mentioned in roaima’s answer, the standard does allow additional fields to be added to struct stat. Some platforms have eschewed that however; on Linux for example the file creation time is available in struct statx, which is returned by the statx function. Adding fields to struct stat itself would create a risk of conflict with future issues of the standard.

If you want to change that, you’ll need to get involved with the Austin Group, which is in charge of updating POSIX. You should plan on dedicating quite a lot of time to familiarise yourself with its way of working, and to participate passively before suggesting changes. You could start by looking at how the standard currently defines the existing timestamps, and where they are mentioned (including every single function which results in updating them).

Note that to a large extent, POSIX isn’t the right venue to drive change; it tends to document features and normalise them once they are supported somewhere and have proven themselves useful.

  • You are wrong POSIX does not require a feature to be widely supported. It just forbids invention by POSIX. A single existing implementation is sufficient if a feature is highly useful. BTW: Today, it is mainly GNU features that prevent a change to more features. since GNU extensions are frequently in conflict with extensions from the rest of the world. – schily May 27 at 9:24
  • Thanks for the clarification, I’ve updated the answer. – Stephen Kitt May 27 at 10:50

POSIX does not define btime. However, it does allow for additional fields in the stat structure, "which shall include at least the following members", so I see no reason why non-POSIX implementations cannot include btime and still remain POSIX compliant.

struct timespec st_atim    Last data access timestamp. 
struct timespec st_mtim    Last data modification timestamp. 
struct timespec st_ctim    Last file status change timestamp. 
  • Exactly POSIX does not define it, but should it be defined? If not defined, then it puts free to use btime (if it is available) as you want, right? – johnf May 21 at 14:36
  • You would have to convince whoever controls POSIX that a btime equivalent was worth adding to the specification. In the meantime you can indeed use btime whenever it's implemented – roaima May 21 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.