clock : clock « time.h « C Tutorial






ItemValue
Header filetime.h
Declarationclock_t clock(void);
Returnreturns time or -1 if the time is not available.


To transform this value into seconds, divide it by CLOCKS_PER_SEC.

#include <time.h>
  #include <stdio.h>

  int main(void)
  {
   
    printf("Elapsed time: %u secs.\n", clock()/CLOCKS_PER_SEC);
   
  }
Elapsed time: 0 secs.








25.3.clock
25.3.1.clock