#include <iostream>
#include <ctime>
int main()
{
std::time_t t = std::time(0); // t is an integer type
std::cout << t << " seconds since 01-Jan-1970\n";
return 0;
}
1.获取以秒为单位的时间戳1.1 C++风格#include <iostream>#include <ctime> int main(){ std::time_t t = std::time(0); // t is an integer type std::cout << t << " seconds since 01-Jan-1970\n"; return 0;}1.2 C风格#include <