C语言库difftime()函数

#include stdio.h#include time.hint main () {time_t start_t, end_t;double diff_t;printf(Starting of the program...\\n);

编程学习网为您整理以下代码实例,主要实现:C语言库difftime()函数,希望可以帮到各位朋友。

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

int main () {
   time_t start_t, end_t;
   double diff_t;

   printf("Starting of the program...\n");
   time(&start_t);

   printf("SleePing for 5 seconds...\n");
   sleep(5);

   time(&end_t);
   diff_t = difftime(end_t, start_t);

   printf("Execution time = %f\n", diff_t);
   printf("Exiting of the program...\n");

   return(0);
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐