📜  测量时间 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:38.909000             🧑  作者: Mango

代码示例2
void timeWait (float threshold) {
    float timeInitial, timeMeasured, timeDelta = 0;

    timeInitial = (float)clock();
    while (timeDelta < threshold) {
        timeMeasured = (float)clock();
        timeDelta = ((timeMeasured - timeInitial) / (float)CLOCKS_PER_SEC);
    }
    printf("%.2f - %.2f s have passed.", threshold, timeDelta);
}