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; }