zoukankan      html  css  js  c++  java
  • C --gettimeofday===获取某个程序经历的时间

    #include <stdio.h> 
    #include <sys/time.h>
    #include <time.h>
    int gettimeofday(struct timeval*tv,struct timezone *tz);
    
    int main(int argc, char* argv[])
    { 
       int timeuse; 
       struct timeval starttime,endtime;
       gettimeofday(&starttime,0);
         sleep(2);
       gettimeofday(&endtime,0);  
       timeuse=(endtime.tv_sec-starttime.tv_sec)*1000000+endtime.tv_usec-starttime.tv_usec;
       timeuse/=1000 ;
       printf("the programme run %d second/n the result of 1+2+3+....100 
     ",timeuse);
       printf("Hello World!
    ");
        return 0;
    }

    获取某个程序运行经历的时间差值.

  • 相关阅读:
    Html中常用的属性
    vue-页面回退
    vue-watch
    html
    Html-列表
    vue项目中px自动转换为rem
    vuex使用
    localStorage的使用
    slot
    模糊查询
  • 原文地址:https://www.cnblogs.com/aspirant/p/3756694.html
Copyright © 2011-2022 走看看