求 difftime 算法、源码

dading_105 2007-04-10 09:19:15
最近在单片机上求2个时间的差,希望能找到一种可靠的、稳定、高效的算法,望高手指点
...全文
217 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jixingzhong 2007-04-10
  • 打赏
  • 举报
回复
http://zhanjun.net/?q=node/11
jixingzhong 2007-04-10
  • 打赏
  • 举报
回复
#include “stdio.h”
#include “stdlib.h”
#include “time.h”

int main( void )
{
long i = 10000000L;
clock_t start, finish;
double duration;
/* 测量一个事件持续的时间*/
printf( "Time to do %ld empty loops is ", i );
start = clock();
while( i-- )
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
printf( "%f seconds\n", duration );
system("pause");
}
王集鹄 2007-04-10
  • 打赏
  • 举报
回复
参考
http://blog.yesky.com/372/Keying/1636872.shtml
dading_105 2007-04-10
  • 打赏
  • 举报
回复
已经看了\vc7\crt\src\gmtime.c,基本已经搞定了,谢谢各位

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧