1clock_t begin = clock();
2
3/* here, do your time-consuming job */
4
5clock_t end = clock();
6double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;1void timeWait (float threshold) {
2    float timeInitial, timeMeasured, timeDelta = 0;
3
4    timeInitial = (float)clock();
5    while (timeDelta < threshold) {
6        timeMeasured = (float)clock();
7        timeDelta = ((timeMeasured - timeInitial) / (float)CLOCKS_PER_SEC);
8    }
9    printf("%.2f - %.2f s have passed.", threshold, timeDelta);
10}