读书人

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

发布时间: 2012-02-14 19:19:19 作者: rapoo

取系统当前时间,有没有精确到毫秒的函数?
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);

读书人网 >C语言

热点推荐