如果在C/C++获取当前系统毫秒时间 ,要借助timeval
#include <stdio.h>
#include <sys/time.h>
long getCurrentTime()
{
struct timeval tv;
gettimeofday(&tv,NULL);
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
int main()
{
printf("c/c++ program:%ld\n",getCurrentTime());
return 0;
}
在此做个笔记,以防后面忘记了……
**************************************************************************************************************