相关疑难解决方法(0)

将clock_gettime移植到窗口

我在qnx momemntics上运行以下代码.

#define BILLION 1000000000L;

struct timespec start_time;
struct timespec stop_time; 

void start MyTestFunc() {
    //Initialize the Test Start time
     clock_gettime(CLOCK_REALTIME,&start_time)
    // ... additonal code.

    cout << "The exectuion time of func "<< calculateExecutionTime();
}


double calculateExecutionTime ()
{

    clock_gettime(CLOCK_REALTIME,&stop_time);

    double dSeconds = (stop_time.tv_sec - start_time.tv_sec);

    double dNanoSeconds = (double)( stop_time.tv_nsec - start_time.tv_nsec ) / BILLION;

    return dSeconds + dNanoSeconds;
}
Run Code Online (Sandbox Code Playgroud)

现在我想将代码移植到Windows上.任何人都可以提供示例代码.

谢谢!

c c++ windows

19
推荐指数
4
解决办法
4万
查看次数

标签 统计

c ×1

c++ ×1

windows ×1