time fixes
This commit is contained in:
@ -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);
|
||||
|
@ -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<NTSTATUS>(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 {
|
||||
|
Reference in New Issue
Block a user