作者mosquito520 ( )
看板SetupBBS
标题Re: <转录/Local Save> 三篇关於 date_stamp 实作
时间Sun Jan 31 16:32:20 2010
: 但是 ...
: 那 我们有没有办法输入 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