Last active
August 29, 2015 13:56
-
-
Save disktnk/8979225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++11 | |
#include <iostream> | |
#include <chrono> | |
const auto startTime = std::chrono::system_clock::now(); | |
// do something | |
const auto endTime = std::chrono::system_clock::now(); | |
const auto elapse = endTime - startTime; | |
std::cout << "elapse: " << | |
std::chrono::duration_cast<std::chrono::milliseconds>(elapse).count() << "[ms]" | |
<< std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++11 | |
#include <iostream> | |
#include <chrono> | |
const std::chrono::system_clock::time_point startTime = std::chrono::system_clock::now(); | |
// do something | |
const std::chrono::system_clock::time_point endTime = std::chrono::system_clock::now(); | |
std::cout << "elapse: " << | |
std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count() << "[ms]" | |
<< std::endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment