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
上午/下午