C++ 获取当前时间毫秒数

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

string getCurrentTime(){
	long long time_last;
	time_last = time(NULL);   

	struct timeb t1;
	ftime(&t1);
	time_t ttt= t1.millitm+t1.time*1000;
	std::stringstream ss;
	ss << ttt;
	std::string ts = ss.str();
	return ts;
}

  

posted @ 2014-03-25 16:51  taylor.yan  阅读(4620)  评论(0编辑  收藏  举报