1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include <iostream>
#include <chrono>
#include <filesystem>
using namespace std;
using namespace chrono;
using namespace filesystem;
namespace fs = filesystem;
auto local_time_point(time_point<system_clock> const &tp, char const *fmt)
{
time_t secs = system_clock::to_time_t( tp );
return put_time(localtime(&secs), fmt);
}
int main()
{
// system_clock::duration ds{ 24h };
// file_clock::duration df{ 1h };
file_clock::time_point p1 = fs::last_write_time("clock.cc");
file_clock::time_point p2 = fs::last_write_time("clock.cc");
cout << (p1 == p2) << '\n';
return 0;
system_clock::from_time_t(
system_clock::to_time_t(
system_clock::from_time_t(
12345
)
)
);
std::time_t tm {time(0)};
std::cout << std::put_time(std::localtime(&tm), "%c") << '\n';
time_t secs = system_clock::to_time_t( system_clock::now() );
cout << put_time(std::localtime(&secs), "%c\n");
cout << local_time_point(system_clock{}.now(), "%c") << '\n';
// file_clock::to_time_t(file_clock::from_time_t(12345));
high_resolution_clock::to_time_t(high_resolution_clock::from_time_t(12345));
// steady_clock::to_time_t(steady_clock::from_time_t(12345));
// unsigned uval = system_clock::period::num;
// file_clock::period rf;
// system_clock::rep vs;
// file_clock::rep vf;
// system_clock::time_point st = system_clock{}.now();
file_clock::time_point ft;
}
|