我对 Ubuntu 很陌生,但我似乎无法让它工作。它在我的学校计算机上运行良好,我不知道我没有在做什么。我检查了usr/include和 time.h 就可以了。这是代码:
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
timespec time1, time2;
int temp;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);
//do stuff here
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);
return 0;
}
我也使用 CodeBlocks 作为我的 IDE 来构建和运行。任何帮助都会很棒,谢谢。