C++时间计算

#include 
#include 

/*
 * Pause funciton to pause tha animation for a few milliseconds
 * so that it doesn't go by too fast.
 */
void pause(double ms) {
    auto start= std::chrono::high_resolution_clock::now();
    while(true) {
       auto end = std::chrono::high_resolution_clock::now();
       auto duration = std::chrono::duration_cast(end-start).count();
       if(duration > ms) return;
    }
}
#include 
    time_t startTime = time(NULL);
    while(difftime(time(NULL),startTime) <= excuteTimeInS){
        UpdateGraph(*p_G);
    }

你可能感兴趣的:(C++时间计算)