c語言獲取系統當前時間的函數,求講解
c語言獲取系統當前時間的函數,求講解?
慕桂英3389331
2019-02-04 10:06:05
TA貢獻1828條經驗 獲得超13個贊
time_t是個重定義的長整型結構。
調用time函數獲取時間,返回的是一個秒數。
當前時間需要調用localtime進行轉換一下。
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};
舉報