文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Linux下高精度时间的获取

Linux下高精度时间的获取

时间:2007-04-04  来源:pascal4123

#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>

int main()
{
struct        timeb        tp;
struct        tm        * tm;

ftime (&tp);
tm = localtime (&( tp.time ));

printf("%02d:%02d:%02d:%03d\n", (tm->tm_hour), (tm->tm_min), (tm->tm_sec),(tp.millitm )); //?

}
  这个是纳秒级的.

CODE:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/unistd.h>
inline unsigned long long GetNTime()
{
        __asm ("RDTSC");
}

int main()
{
        long long time = GetNTime();
        printf( "%qi\n",time );
        return 0;
}        
排行榜 更多 +
房间毁灭模拟器最新版

房间毁灭模拟器最新版

休闲益智 下载
街头追逐者最新版

街头追逐者最新版

休闲益智 下载
弓箭手2内置作弊菜单

弓箭手2内置作弊菜单

休闲益智 下载