ITeye博客

time,gettimeofday,clock_gettime,_ftime

andy136566 · 2011-08-14 21:08 · 20110408实习 · 编程语言 · Markdown

http://blog.csdn.net/sunlylorn/article/details/6313278

 

 

 

 

 

 

 

 

 

 

view plaincopy to clipboardprint?

  1. _ftime()提供毫秒级的精确度
  2. 1、头文件 <sys/types.h> and <sys/timeb.h>
  3. 2、函数原型
  4. void _ftime(struct _timeb *timeptr);
  5. 参数说明:
  6. struct _timeb
  7. {
  8. time_t time;
  9. unsigned short millitm;
  10. short timezone;
  11. short dstflag;
  12. };
  13. #include <stdio.h>
  14. #include <sys/timeb.h>
  15. #include <time.h>
  16. void main( void )
  17. {
  18. struct _timeb timebuffer;
  19. char *timeline;
  20. _ftime( &timebuffer );
  21. timeline = ctime( & ( timebuffer.time ) );
  22. printf( "The time is %.19s.%hu %s", timeline, timebuffer.millitm, &timeline[20] );
  23. }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。