首页 > 系统服务 > 详细

Use of undeclared identifier 'CLK_TCK' on Mac

时间:2020-07-21 15:24:43      阅读:157      评论:0      收藏:0      [点我收藏+]

#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 。

Use of undeclared identifier 'CLK_TCK' on Mac

原文:https://www.cnblogs.com/JaneLin0409/p/13354457.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!