C Tutorial/time.h/difftime — различия между версиями


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Версия 14:21, 25 мая 2010

difftime

Item Value Header file time.h Declaration double difftime(time_t time2, time_t time1); Return returns the difference, in seconds, between time1 and time2( time2 - time1).


#include <time.h>
  #include <stdio.h>
  int main(void)
  {
    time_t start, end;
    volatile long unsigned t;
    start = time(NULL);
    for(t=0; t<500; t++) ;
    end = time(NULL);
    printf("Loop used %f seconds.\n", difftime(end, start));
    return 0;
  }