现在的位置: 首页 > 综合 > 正文

difftime(转)

2018年05月25日 ⁄ 综合 ⁄ 共 443字 ⁄ 字号 评论关闭
函数名: difftime

  功 能: 计算两个时刻之间的时间差

  用 法: double difftime(time_t time2, time_t time1);

  程序例:

  #include <time.h>

  #include <stdio.h>

  #include <dos.h>

  #include <conio.h>

  int main(void)

  {

  time_t first, second;

  clrscr();

  first = time(NULL); /* Gets system

  time */

  delay(2000); /* Waits 2 secs */

  second = time(NULL); /* Gets system time

  again */

  printf("The difference is: %f \

  seconds\n",difftime(second,first));

  getch();

  return 0;

  }

抱歉!评论已关闭.