- #include <iostream>
- #include <ctime>
- using namespace std;
- int main()
- {
- time_t now;
- struct tm *fmt;
- time(&now);
- fmt = localtime(&now);
- cout<<fmt->tm_year+1900<<" "<<fmt->tm_mon+1<<" "<<fmt->tm_mday<<" ";
- cout<<fmt->tm_hour<<" "<<fmt->tm_min<<" "<<fmt->tm_sec<<endl;
- return 0;
- }
linux下获取系统当前时间
最新推荐文章于 2024-01-18 10:03:22 发布