Last active
April 1, 2021 18:39
-
-
Save paulodiogo/73686adb0a00a5062addefb58aff957d to your computer and use it in GitHub Desktop.
Medição de tempo em C++
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 <sys/time.h> | |
struct timespec begin; | |
clock_gettime(CLOCK_MONOTONIC, &begin); | |
{ | |
//RODAR METODO AQUI | |
} | |
struct timespec end; | |
clock_gettime(CLOCK_MONOTONIC, &end); | |
double time_spent = double(end.tv_sec - begin.tv_sec) + (end.tv_nsec - begin.tv_nsec) / 1000000000.0; // segundos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment