diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index d0c11b6c..31d6f79d 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -238,8 +238,10 @@ VOID winfsp_drive::Cleanup(PVOID file_node, PVOID file_desc, if ((flags & FspCleanupSetChangeTime) != 0U) { auto res = provider_.set_item_meta( - api_path, {{META_CHANGED, std::to_string(now)}, - {META_MODIFIED, std::to_string(now)}}); + api_path, { + {META_CHANGED, std::to_string(now)}, + {META_MODIFIED, std::to_string(now)}, + }); if (res != api_error::success) { utils::error::raise_api_path_error( function_name, api_path, res, @@ -1058,17 +1060,22 @@ auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc, meta[META_ATTRIBUTES] = std::to_string(attributes); } if ((creation_time != 0U) && (creation_time != max_time)) { - meta[META_CREATION] = std::to_string(creation_time); + meta[META_CREATION] = std::to_string( + utils::time::windows_time_to_unix_time(creation_time)); } if ((last_access_time != 0U) && (last_access_time != max_time)) { - meta[META_ACCESSED] = std::to_string(last_access_time); + meta[META_ACCESSED] = std::to_string( + utils::time::windows_time_to_unix_time(last_access_time)); } if ((last_write_time != 0U) && (last_write_time != max_time)) { - meta[META_WRITTEN] = std::to_string(last_write_time); + meta[META_WRITTEN] = std::to_string( + utils::time::windows_time_to_unix_time(last_write_time)); } if ((change_time != 0U) && (change_time != max_time)) { - meta[META_CHANGED] = std::to_string(change_time); - meta[META_MODIFIED] = std::to_string(change_time); + meta[META_CHANGED] = + std::to_string(utils::time::windows_time_to_unix_time(change_time)); + meta[META_MODIFIED] = + std::to_string(utils::time::windows_time_to_unix_time(change_time)); } error = provider_.set_item_meta(api_path, meta); diff --git a/repertory/librepertory/src/utils/windows/windows_utils.cpp b/repertory/librepertory/src/utils/windows/windows_utils.cpp index 367f4e6c..73888b98 100644 --- a/repertory/librepertory/src/utils/windows/windows_utils.cpp +++ b/repertory/librepertory/src/utils/windows/windows_utils.cpp @@ -23,9 +23,8 @@ #include "utils/windows/windows_utils.hpp" -#include "types/startup_exception.hpp" -#include "utils/com_init_wrapper.hpp" #include "utils/string.hpp" +#include "utils/time.hpp" #if !defined(STATUS_DEVICE_INSUFFICIENT_RESOURCES) #define STATUS_DEVICE_INSUFFICIENT_RESOURCES static_cast(0xC0000468L) @@ -88,19 +87,23 @@ auto from_api_error(const api_error &e) -> NTSTATUS { } auto get_accessed_time_from_meta(const api_meta_map &meta) -> std::uint64_t { - return utils::string::to_uint64(meta.at(META_ACCESSED)); + return utils::time::unix_time_to_windows_time( + utils::string::to_uint64(meta.at(META_ACCESSED))); } auto get_changed_time_from_meta(const api_meta_map &meta) -> std::uint64_t { - return utils::string::to_uint64(meta.at(META_MODIFIED)); + return utils::time::unix_time_to_windows_time( + utils::string::to_uint64(meta.at(META_MODIFIED))); } auto get_creation_time_from_meta(const api_meta_map &meta) -> std::uint64_t { - return utils::string::to_uint64(meta.at(META_CREATION)); + return utils::time::unix_time_to_windows_time( + utils::string::to_uint64(meta.at(META_CREATION))); } auto get_written_time_from_meta(const api_meta_map &meta) -> std::uint64_t { - return utils::string::to_uint64(meta.at(META_WRITTEN)); + return utils::time::unix_time_to_windows_time( + utils::string::to_uint64(meta.at(META_WRITTEN))); } auto unix_access_mask_to_windows(std::int32_t mask) -> int {