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