0
void clock(int hour, int minute){
wstringstream wss;
time_t second;
struct tm *current;
current = localtime(&second); // get the running time which is in ms
second = clock()/1000-extra; //now convert it to second, "extra" is 0 in the start
char buffer[80];
if (second == 60){
setminute(clock()/1000/60);
i=1;
extra=extra + 60*(i);
//when 60 passed, second will return to 0, i start at 0 in somewhere else;
}
else if (startminute == 60){ sethour(clock()/1000/60/60); setminute(0); }
wss << starthour << " : ";
wss << startminute << " : ";
wss << second << " ";
wss << "AM" << endl;
textToGenerate.append(wss.str());
}
这是我如何将程序运行时间转换为小时分秒格式。我在上午12:00设定时钟。它看起来像这样12 : 0 : 0 am
在屏幕上在漂亮的格式显示在屏幕上的时间
我想知道是否有反正我可以将格式更改为标准00:00:00
AM/PM