I wrote a solution for windows using MSVC2015 where the follow code converts the std::filesystem::last_write_time result time_t:
time_t ftime = std::file_time_type::clock::to_time_t(fs::last_write_time("/Path/filename"))
It works well. Then when I tried to port the solution to Linux using gcc 9.3 (-std=C++2a) I've got the follow error:
Error: 'to_time_t' is not member of 'std::chrono::time_point::clock' {aka 'std::filesystem::__file_clock'}
I searched for a solution, but what I found is based on solution included on example of std::filesystem::last_write_time at cplusplus.com. The solution is shown bellow:
auto ftime = fs::last_write_time(p);
std::time_t cftime = decltype(ftime)::clock::to_time_t(ftime);
Unfortunately it doesn't work to me. Actually, the example has a comment that say it won't work at MSVC(worked at MSVC2015) or GCC 9; C++20 will allow portable output.
Now, I'm stuck... How can I make this conversion using gcc?