2 回答
TA貢獻1779條經驗 獲得超6個贊
使用:
1 | time_t mktime(std::tm *timeptr) |
然后我們注意到tm這個結構體:
1 2 3 4 5 6 7 8 9 10 11 | struct tm { int tm_sec // seconds after the minute 0-61* 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 Saving Time flag }; |
你只要初始化每一個字段就可以得到tm對象,調用mktime方法就可以得到一個time_t對象,于是便可與system_clock中to_time_t方法返回的結果進行比較。
- 2 回答
- 0 關注
- 1161 瀏覽
添加回答
舉報
