首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

取系统当前时间,有没有精确到毫秒的函数?该怎么解决

2012-02-14 
取系统当前时间,有没有精确到毫秒的函数?RT [解决办法]#includetime.hclock_t startclock()//...clock

取系统当前时间,有没有精确到毫秒的函数?
RT


[解决办法]
#include <time.h>

clock_t start=clock();

//...

clock_t end=clock();

unsigned int dis_time=end-start;
[解决办法]
#include <windows.h>
LARGE_INTEGER LargeInt;
QueryPerformanceFrequency(&LargeInt);
double Frequency = (double)LargeInt.QuadPart;

LONGLONG Start,End;
QueryPerformanceCounter((LARGE_INTEGER *)&Start);
//...
QueryPerformanceCounter((LARGE_INTEGER *)&End);

double Time = (End - Start)/Frequency;
[解决办法]
#include "windows.h "
int main()
{
SYSTEMTIME lTime;
GetLocalTime(&lTime);

return 0;

}

[解决办法]
struct timeval usex;

gettimeofday(&usex,NULL);

热点排行