Bug #14352 ยป FileUtils.C.patch
| src/web/FileUtils.C | ||
|---|---|---|
|
std::chrono::system_clock::time_point lastWriteTime(const std::string &file)
|
||
|
{
|
||
|
#ifdef WT_FILESYSTEM_IMPL_STD
|
||
|
#ifndef WT_FILESYSTEM_IMPL_STD_CLOCK_17
|
||
|
auto ftime = Wt::cpp17::filesystem::last_write_time(file);
|
||
|
auto systime = decltype(ftime)::clock::to_sys(ftime);
|
||
|
return std::chrono::system_clock::from_time_t(decltype(systime)::clock::to_time_t(systime));
|
||
|
#else // WT_FILESYSTEM_IMPL_STD_CLOCK_17
|
||
|
LOG_DEBUG("When using cpp17 or lower with std::filesystem, the result of this function is an approximation. Use boost::filesystem, instead of std::filesystem (see WT_CPP17_FILESYSTEM_IMPLEMENTATION) if this is a problem for your application.");
|
||
|
auto ftime = Wt::cpp17::filesystem::last_write_time(file);
|
||
|
return std::chrono::time_point_cast<std::chrono::system_clock::duration>(ftime - Wt::cpp17::filesystem::file_time_type::clock::now() + std::chrono::system_clock::now());
|
||
|
#endif //WT_FILESYSTEM_IMPL_STD_CLOCK_17
|
||
|
return std::chrono::time_point_cast<std::chrono::system_clock::duration>(systime);
|
||
|
#else // !WT_FILESYSTEM_IMPL_STD
|
||
|
return std::chrono::system_clock::from_time_t(Wt::cpp17::filesystem::last_write_time(file));
|
||
|
#endif // WT_FILESYSTEM_IMPL_STD
|
||