fixes
This commit is contained in:
@ -1310,20 +1310,21 @@ auto fuse_drive::utimens_impl(std::string api_path,
|
||||
}
|
||||
|
||||
meta.clear();
|
||||
const auto process_timespec = [&meta](auto *tv, const auto &val,
|
||||
std::string attr) {
|
||||
if ((tv == nullptr) || (val.tv_nsec == UTIME_NOW)) {
|
||||
|
||||
const auto process_timespec = [&meta, &tv](const auto &src,
|
||||
std::string attr) {
|
||||
if ((tv == nullptr) || (src.tv_nsec == UTIME_NOW)) {
|
||||
meta[attr] = std::to_string(utils::time::get_time_now());
|
||||
} else if (val.tv_nsec != UTIME_OMIT) {
|
||||
} else if (src.tv_nsec != UTIME_OMIT) {
|
||||
meta[attr] = std::to_string(
|
||||
val.tv_nsec +
|
||||
(val.tv_sec * static_cast<std::decay_t<decltype(val.tv_sec)>>(
|
||||
src.tv_nsec +
|
||||
(src.tv_sec * static_cast<std::decay_t<decltype(src.tv_sec)>>(
|
||||
utils::time::NANOS_PER_SECOND)));
|
||||
}
|
||||
};
|
||||
|
||||
process_timespec(tv, tv[0U], META_ACCESSED);
|
||||
process_timespec(tv, tv[1U], META_MODIFIED);
|
||||
process_timespec(tv[0U], META_ACCESSED);
|
||||
process_timespec(tv[1U], META_MODIFIED);
|
||||
|
||||
if (not meta.empty()) {
|
||||
return provider_.set_item_meta(api_path, meta);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
namespace repertory {
|
||||
auto fuse_drive_base::access_impl(std::string api_path, int mask) -> api_error {
|
||||
@ -234,8 +235,8 @@ void fuse_drive_base::get_timespec_from_meta(const api_meta_map &meta,
|
||||
const std::string &name,
|
||||
struct timespec &ts) {
|
||||
const auto meta_time = utils::string::to_int64(meta.at(name));
|
||||
ts.tv_nsec = meta_time % NANOS_PER_SECOND;
|
||||
ts.tv_sec = meta_time / NANOS_PER_SECOND;
|
||||
ts.tv_nsec = meta_time % utils::time::NANOS_PER_SECOND;
|
||||
ts.tv_sec = meta_time / utils::time::NANOS_PER_SECOND;
|
||||
}
|
||||
|
||||
auto fuse_drive_base::get_uid_from_meta(const api_meta_map &meta) -> uid_t {
|
||||
@ -342,8 +343,8 @@ void fuse_drive_base::set_timespec_from_meta(const api_meta_map &meta,
|
||||
const std::string &name,
|
||||
struct timespec &ts) {
|
||||
const auto meta_time = utils::string::to_int64(meta.at(name));
|
||||
ts.tv_nsec = meta_time % NANOS_PER_SECOND;
|
||||
ts.tv_sec = meta_time / NANOS_PER_SECOND;
|
||||
ts.tv_nsec = meta_time % utils::time::NANOS_PER_SECOND;
|
||||
ts.tv_sec = meta_time / utils::time::NANOS_PER_SECOND;
|
||||
}
|
||||
} // namespace repertory
|
||||
|
||||
|
Reference in New Issue
Block a user