I'm uncertain whether this is a platform difference or an implementation difference. I'm hoping that someone can help me shed light on that. Given this code:
filesystem::path foo("foo");
filesystem::path bar("bar");
filesystem::create_directories(foo);
filesystem::copy(foo, bar);
const auto fooftime = filesystem::last_write_time(foo);
const auto barftime = filesystem::last_write_time(bar);
const auto foocftime = decltype(fooftime)::clock::to_time_t(fooftime);
const auto barcftime = decltype(barftime)::clock::to_time_t(barftime);
cout << '(' << foocftime << ')' << asctime(localtime(&foocftime)) << '(' << barcftime << ')' << asctime(localtime(&barcftime)) << (fooftime == barftime) << endl;
(1513798777)Wed Dec 20 19:39:37 2017
(1513798777)Wed Dec 20 19:39:37 2017
1
But Visual Studio will output:
(1513798819)Wed Dec 20 14:40:19 2017
(1513798819)Wed Dec 20 14:40:19 2017
0
This seems like fooftime
and barftime
are equal, but when I inspect the variables in the Visual Studio debugger they contain more precision than they're outputting, and they differ in that extended precision. Can someone help me understand where the breakdown here is?