time,gettimeofday,clock_gettime,_ftime
http://blog.csdn.net/sunlylorn/article/details/6313278
view plaincopy to clipboardprint?
- _ftime()提供毫秒级的精确度
- 1、头文件 <sys/types.h> and <sys/timeb.h>
- 2、函数原型
- void _ftime(struct _timeb *timeptr);
- 参数说明:
- struct _timeb
- {
- time_t time;
- unsigned short millitm;
- short timezone;
- short dstflag;
- };
- #include <stdio.h>
- #include <sys/timeb.h>
- #include <time.h>
- void main( void )
- {
- struct _timeb timebuffer;
- char *timeline;
- _ftime( &timebuffer );
- timeline = ctime( & ( timebuffer.time ) );
- printf( "The time is %.19s.%hu %s", timeline, timebuffer.millitm, &timeline[20] );
- }