time fixes

This commit is contained in:
2024-08-23 12:52:42 -05:00
parent 9e9d46a9cd
commit f8e7e8f0e3

View File

@ -1749,15 +1749,22 @@ auto remote_server::json_release_directory_snapshot(
auto remote_server::update_to_windows_format(json &item) -> json & {
const auto api_path = item["path"].get<std::string>();
item["meta"][META_MODIFIED] = std::to_string(
utils::time::unix_time_to_windows_time(utils::string::to_uint64(
empty_as_zero(item["meta"][META_MODIFIED]))));
item["meta"][META_CREATION] = std::to_string(
utils::time::unix_time_to_windows_time(utils::string::to_uint64(
empty_as_zero(item["meta"][META_CREATION]))));
item["meta"][META_ACCESSED] = std::to_string(
utils::time::unix_time_to_windows_time(utils::string::to_uint64(
empty_as_zero(item["meta"][META_ACCESSED]))));
utils::string::to_uint64(empty_as_zero(item["meta"][META_ACCESSED])));
item["meta"][META_CREATION] = std::to_string(
utils::string::to_uint64(empty_as_zero(item["meta"][META_CREATION])));
item["meta"][META_MODIFIED] = std::to_string(
utils::string::to_uint64(empty_as_zero(item["meta"][META_MODIFIED])));
if (item["meta"][META_WRITTEN].empty() ||
(item["meta"][META_WRITTEN].get<std::string>() == "0") ||
(item["meta"][META_WRITTEN].get<std::string>() ==
std::to_string(WIN32_TIME_CONVERSION))) {
drive_.set_item_meta(api_path, META_WRITTEN,
item["meta"][META_MODIFIED].get<std::string>());
item["meta"][META_WRITTEN] = item["meta"][META_MODIFIED];
}
if (item["meta"][META_ATTRIBUTES].empty()) {
item["meta"][META_ATTRIBUTES] =
item["directory"].get<bool>() ? std::to_string(FILE_ATTRIBUTE_DIRECTORY)
@ -1766,19 +1773,6 @@ auto remote_server::update_to_windows_format(json &item) -> json & {
item["meta"][META_ATTRIBUTES].get<std::string>());
}
if (item["meta"][META_WRITTEN].empty() ||
(item["meta"][META_WRITTEN].get<std::string>() == "0") ||
(item["meta"][META_WRITTEN].get<std::string>() == "116444736000000000")) {
drive_.set_item_meta(api_path, META_WRITTEN,
item["meta"][META_MODIFIED].get<std::string>());
item["meta"][META_WRITTEN] = std::to_string(
utils::time::unix_time_to_windows_time(utils::string::to_uint64(
empty_as_zero(item["meta"][META_MODIFIED]))));
} else {
item["meta"][META_WRITTEN] = std::to_string(
utils::time::unix_time_to_windows_time(utils::string::to_uint64(
empty_as_zero(item["meta"][META_WRITTEN]))));
}
return item;
}
} // namespace repertory::remote_fuse