struct tm{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday; // day of month
int tm_mon;
int tm_year;
int tm_wday; // day of week
int tm_yday; // day of year
int tm_isdst; // daylight saving time
};
std::clock(); returns std::clock_t values
std::time_t std::time(std::time_t *); returns std::time_t values
char *ctime(const std::time_t *arg); // converts std::time_t value into string
std::tm* gmtime(std::time_t *arg); // converts time_t to UTC(Cordinated Universal Time) tm
std::tm* localtime(std::time_t *arg); // converts time_t to local tm
std::time_t mktime(std::tm *arg); // converts tm to time_t
char* asctime(std::tm *arg); // converts tm to string 'Www Mmm dd hh:mm:ss yyyy'
// converts tm to string according to format and store into str with at max count chars
// format: %Y %m %d %H %M %S : Year month day Hour Minite Secode
std::size_t strftime( char* str, std::size_t count, const char* format, const std::tm* time );
get time() then parse time_t to tm object, then convert tm object to time strings
转载请注明原文地址: https://ju.6miu.com/read-33882.html