一、秒级时间:
#include
#include
#include
int main()
{
struct timeb tp;
struct tm * tm;
ftime ( &tp );
tm = localtime (
& ( tp.time )
);
printf ( "d:d:d:d\n", ( tm -> tm_hour ) , ( tm
-> tm_min )
,
( tm -> tm_sec
), ( tp.millitm ) );
}
二、纳秒级时间
#include
#include
#include
#include
inline unsigned long long GetNTime()
{
__asm
("RDTSC");
}
int main()
{
long long time = GetNTime();
printf( "%qi\n",time );
return 0;
}
阅读(597) | 评论(0) | 转发(0) |