#include
#include
int main(void)
{
while(true)
{
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
auto tt = std::chrono::system_clock::to_time_t(now);
struct tm* ptm = localtime(&tt);
char current_time[128] = { 0 };
char current_date[20] = { 0 };
char date_path[100] = { 0 };
std::chrono::milliseconds ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
sprintf(current_date, "%d%02d%02d", (int)ptm->tm_year + 1900, (int)ptm->tm_mon + 1, (int)ptm->tm_mday);
sprintf(current_time, "%s %02d:%02d:%02d.%d", current_date, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)ms.count());
printf("输出:%s\n", current_time);
::Sleep(10);
}
return 0;
}