Bridge file clock durations across standard libraries (by Codex)
This commit is contained in:
1 parent
246e63a550
commit
3891706023
1 file changed
+5
-1
@@ -210,7 +210,11 @@ void DemoFiles::validate(const Json &data) const {
|
||||
DemoFileEntry DemoFiles::decode(const fs::path &file, const std::string &raw) const {
|
||||
DemoFileEntry row;
|
||||
row.id = editor::utf8(file.filename()); row.token = content::sha256(raw); row.bytes = raw.size();
|
||||
row.modified = stamp(std::chrono::time_point_cast<std::chrono::system_clock::duration>(std::chrono::file_clock::to_sys(fs::last_write_time(file))));
|
||||
// Bridge relative durations instead of relying on file_clock::to_sys,
|
||||
// which is not provided by every supported standard library.
|
||||
const auto elapsed = fs::last_write_time(file) - fs::file_time_type::clock::now();
|
||||
row.modified = stamp(std::chrono::system_clock::now() +
|
||||
std::chrono::duration_cast<std::chrono::system_clock::duration>(elapsed));
|
||||
const auto value = Json::parse(raw);
|
||||
if (value.value("schema", "") == "openbmh-ui-file@1") {
|
||||
const auto expected_kind = kind_ == DemoFileKind::career ? "career" : "desktop";
|
||||
|
||||
Reference in new issue
Block a user