Category : time

From std::chrono::system_clock::now in cppreference #include <iostream> #include <iomanip> #include <vector> #include <numeric> #include <chrono> volatile int sink; int main() { std::cout << std::fixed << std::setprecision(9) << std::left; for (auto size = 1ull; size < 1000’000’000ull; size *= 100) { // record start time auto start = std::chrono::system_clock::now(); // do some work std::vector<int> v(size, 42); sink ..

Read more

When the windows time is set with a wrong time and a file is created,the file takes that time as date modified. Later on,when the time is corrected, the file still remains with wrong time and it is hard to understand when the file was modified. To avoid this confusion,how can the time of windows ..

Read more

#include <iostream> #include <chrono> int main() { std::chrono::time_point<std::chrono::system_clock> start_time, end_time; start_time = std::chrono::system_clock::now(); //do something for (int i = 0; i<100000; ++i) std::cout << ""; end_time = std::chrono::system_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time – start_time); std::cout << "n" << duration.count(); return 0; } I haven’t seen it clearly in the docs, so what to check, that ..

Read more