“Medir el tiempo en C” Código de respuesta

Obtenga tiempo para completar el Código C

clock_t begin = clock();

/* here, do your time-consuming job */

clock_t end = clock();
double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
Revan

Medir el tiempo en C

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);
}
Famous Finch

Respuestas similares a “Medir el tiempo en C”

Preguntas similares a “Medir el tiempo en C”

Más respuestas relacionadas con “Medir el tiempo en C” en C

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código