C ++ program execution time calculation

About time.h

https://www.runoob.com/cprogramming/c-standard-library-time-h.html

#include <the iostream> 
#include <the ctime> the using namespace STD; int main () 
{ struct (TM) T;     // (TM) structured pointer char stTmp [ 32 ]; 
    time_t now;         // declare a variable of time_t 
    now = time (NULL); // get the system date and time time (& now); 
    localtime_s (& t, & now);     // Gets the local date and time 
    cout << t.tm_year + 1900 << " years    " ; 
    cout << t.tm_mon + 1 << " month    " ;
    cost

 


    
    <<t.tm_mday<<"";
    cout<<""<<t.tm_wday<<"  ";//为了输出好看。。
    cout<<t.tm_hour<<"";
    cout<<t.tm_min<<"";
    cout<<t.tm_sec<<"";
    return 0;
}

 

// Compared with time_t, there is a clock_t, is used in recording on cpu time, to distinguish between the two.

Guess you like

Origin www.cnblogs.com/yoriko/p/12237180.html