看板 SetupBBS 關於我們 聯絡資訊
: 但是 ... : 那 我們有沒有辦法輸入 2010 01 12 然後得到 stamp 值呢 ? 很遺憾的 在 ANSI-C : 中 並沒有 這樣的東西 Draft ANSI C Standard (ANSI X3J11/88-090) (May 13, 1988) http://flash-gordon.me.uk/ansi.c.txt 4.12.1 Components of time struct tm which holds the components of a calendar time, called the broken-down time. The structure shall contain at least the following members, in any order. The semantics of the members and their normal ranges are expressed in the comments./123/ int tm_sec; /* seconds after the minute --- [0, 60] */ 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 */ The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight Saving Time is not in effect, and negative if the information is not available. 4.12.2.3 The mktime function Synopsis #include <time.h> time_t mktime(struct tm *timeptr); 這樣不就得到timestamp? 然後丟給difftime就出來了不是? -- ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ 國 立 聯 合 大 學 (理工/電資/管理/技術/客家)院所 招生中 National United University ─────────────────────────────────── 首頁 http://www.nuu.edu.tw BBS telnet://uun.twbbs.org -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.121.37.185