C++输出当前时间
1 #include<ctime> 2 #include<iostream> 3 using namespace std; 4 5 int main(){ 6 time_t timer; 7 8 timer=time(NULL);//或者 time(&timer); 9 10 cout<<timer<<endl;//the number of seconds since 00:00 hours, Jan 1, 1970 11 struct tm *ptr; 12 ptr=localtime(&timer); 13 cout<<asctime(ptr)<<endl;//asctime can Convert tm structure to string 14 }
Look, if you had one shot , one opportunity , to seize everything you ever wanted , in one moment.
Would you captrue it , or just let it slip ?

浙公网安备 33010602011771号