[linux] Fix zero file creation (birth) time

Observed in Ubuntu 24 via Orb on arm-based Mac

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-07-26 20:10:04 +02:00
committed by Konstantin Pastbin
parent fbaa59ce3b
commit 674abcf02e
5 changed files with 56 additions and 19 deletions

View File

@@ -232,6 +232,9 @@ time_t Platform::GetFileCreationTime(std::string const & path)
struct stat st;
if (0 == stat(path.c_str(), &st))
return st.st_atim.tv_sec;
LOG(LERROR, ("GetFileCreationTime stat failed for", path, "with error", strerror(errno)));
// TODO(AB): Refactor to return std::optional<time_t>.
return 0;
}
@@ -241,5 +244,8 @@ time_t Platform::GetFileModificationTime(std::string const & path)
struct stat st;
if (0 == stat(path.c_str(), &st))
return st.st_mtim.tv_sec;
LOG(LERROR, ("GetFileModificationTime stat failed for", path, "with error", strerror(errno)));
// TODO(AB): Refactor to return std::optional<time_t>.
return 0;
}