I'm using c++17 and std::filesystem::last_write_time
already, but now I also need the file creation time, and there doesn't seem to be an API for that in std::filesystem
. Did I miss it? If not, how come there isn't one?
Do I have to resort to non-portable code to extract that creation timestamp? Does Boost. File system, the ancestor of std::filesystem
, have such an API?
I don't think it exists in C++17.
Boost contains boost::filesystem::creation_time
since version 1.75.0 (December 2020). If you don't want to depend on Boost and only care about some platforms, you could use their implementation for inspiration.
Note that creation time is inherently non-portable; although some filesystems do record creation times, POSIX doesn't specify it. Whether this is the reason why C++17 doesn't implement it is anyone's guess.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With