C/time.h/clock

Материал из C\C++ эксперт
Версия от 10:22, 25 мая 2010; Admin (обсуждение | вклад) (1 версия: Импорт контента...)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

clock: returns time or -1 if the time is not available

    
//Declaration:  clock_t clock(void); 
 

//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.
*/