Is clock_gettime() correctly implemented in MinGW GCC 8.2.0?
问题 By chance, I found out about the existence of the clock_gettime() function for Linux systems. Since I'm looking for a way to measure execution time of a function, I tried it in the MinGW gcc 8.2.0 version on a Windows 10 64-bit machine: #include <time.h> #include <stdio.h> int main() { struct timespec tstart, tend; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tstart); for (int i = 0; i < 100000; ++i); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tend); printf("It takes %li nanoseconds for 100,000