Use of undeclared identifier 'CLK_TCK' on Mac

#include <stdio.h>

#include <time.h>

clock_t start, stop;

int main(){

  start = clock();

  function();

  stop = clock();

  double duration = (stop - start)/CLK_TCK;

  return 0;

}

 

看数据结构算法课程,想在mac上的xcode用CLK_TCK跑跑代码,结果遇到“Use of undeclared identifier 'CLK_TCK'”。

解决:使用CLOCKS_PER_SEC而不是 CLK_TCK 。

posted @ 2020-07-21 13:08  蟹蟹蟹蟹  阅读(1532)  评论(0)    收藏  举报