Capturing a time in milliseconds

前端 未结 7 1110
一生所求
一生所求 2020-11-30 07:11

The following piece of code is used to print the time in the logs:

#define PRINTTIME() struct tm  * tmptime;
time_t     tmpGetTime;
time(&tmpGetTime);
tm         


        
7条回答
  •  抹茶落季
    2020-11-30 07:22

    //C++11 Style:

    cout << "Time in Milliseconds =" << 
     chrono::duration_cast(chrono::steady_clock::now().time_since_epoch()).count() 
     << std::endl;
    
    cout << "Time in MicroSeconds=" << 
     chrono::duration_cast(chrono::steady_clock::now().time_since_epoch()).count() 
     << std::endl;
    

提交回复
热议问题