Created
October 2, 2018 20:21
-
-
Save skejeton/f6a1ead2856ceb354f40d6eeab684ce0 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
// Example program | |
#include <iostream> | |
#include <cmath> | |
#include <chrono> | |
int main() | |
{ | |
float test; | |
std::chrono::time_point<std::chrono::system_clock> start, end; //Clock | |
start = std::chrono::system_clock::now(); | |
for (unsigned int i = 0; i < 4294967295; i++) | |
{ | |
test = sqrt(i); | |
} | |
end = std::chrono::system_clock::now(); | |
float elapsed_seconds = std::chrono::duration_cast<std::chrono::milliseconds> | |
(end-start).count(); //calculate elapsed seconds | |
std::cout << test << std::endl; | |
std::cout << elapsed_seconds / 1000 << std::endl; | |
start = std::chrono::system_clock::now(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment