Last active
May 12, 2016 11:06
-
-
Save sergey-shambir/a4ca7f302f19789e44d19de75cab94ca 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
#include <chrono> | |
int main() | |
{ | |
// Через системные часы получаем объект типа time_point. | |
auto timePointBefore = std::chrono::system_clock::now(); | |
RunSomeLongOperation(); | |
// Получаем второй момент времени (после операции). | |
auto timePointAfter = std::chrono::system_clock::now(); | |
auto timeDeltaMsec = std::chrono::duration_cast<std::chrono::milliseconds>(timePointAfter - timePointBefore); | |
std::cerr << "Total time: " << timeDeltaMsec.count() << "ms" << std::endl; | |
return 0; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment