Fix Windows tray show handling
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "csync.h"
|
||||
#include "syncfileitem.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
@@ -74,7 +75,9 @@ time_t FileSystem::fileTimeToTime_t(std::filesystem::file_time_type fileTime)
|
||||
#ifdef HAS_CLOCK_CAST
|
||||
return std::chrono::system_clock::to_time_t(std::chrono::clock_cast<std::chrono::system_clock>(fileTime));
|
||||
#else
|
||||
const auto systemTime = std::chrono::time_point_cast<std::chrono::system_clock::duration>(std::chrono::file_clock::to_sys(fileTime));
|
||||
const auto fileNow = std::filesystem::file_time_type::clock::now();
|
||||
const auto systemNow = std::chrono::system_clock::now();
|
||||
const auto systemTime = std::chrono::time_point_cast<std::chrono::system_clock::duration>(systemNow + (fileTime - fileNow));
|
||||
return std::chrono::system_clock::to_time_t(systemTime);
|
||||
#endif
|
||||
}
|
||||
@@ -83,7 +86,10 @@ std::filesystem::file_time_type FileSystem::time_tToFileTime(time_t fileTime)
|
||||
#ifdef HAS_CLOCK_CAST
|
||||
return std::chrono::clock_cast<std::chrono::file_clock>(std::chrono::system_clock::from_time_t(fileTime));
|
||||
#else
|
||||
return std::chrono::file_clock::from_sys(std::chrono::system_clock::from_time_t(fileTime));
|
||||
const auto fileNow = std::filesystem::file_time_type::clock::now();
|
||||
const auto systemNow = std::chrono::system_clock::now();
|
||||
return std::chrono::time_point_cast<std::filesystem::file_time_type::duration>(
|
||||
fileNow + (std::chrono::system_clock::from_time_t(fileTime) - systemNow));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user