//方案一,将当前时间折算为秒级,再通过相应的时间换算即可
//此文件必须是c++文件
/*
#include
#include
using namespace std;
string now() {
time_t t = time(0);
char buffer[9] = {0};
strftime(buffer, 9, "%H:%M:%S", localtime(&t));
return string(buffer);
}
int main()
{
cout<
return 0;
}
*/
方法二:boost库中的:
#include // for sprintf()
#include // for console output
#include // for std::string
#include
//-----------------------------------------------------------------------------
// Format current time (calculated as an offset in current day) in this form:
//
// "hh:mm:ss.SSS" (where "SSS" are milliseconds)
//--------------------------------------------------------------------------