Redian新闻
>
how to convert GMT to timestamp of the computer's current time
avatar
how to convert GMT to timestamp of the computer's current time# Programming - 葵花宝典
d*r
1
【此篇文章是由自动发信系统所张贴】
⊙ 博彩开启于:Sun Feb 3 23:03:51 2008 类别:单选
⊙ 主题:SB MVP
⊙ 博彩题目描述:
【打对勾者为正确选项】
(1) TB, 压3回4
√(2) Eli, ya 1 dei 4
(3) R Moss, ya 1 dei 7
(4) L Maroney, ya 1 dei 6
(5) others, ya 1 dei 9
(6) zhuang
(7) bk
avatar
s*e
2
如果要做这方面的研究,要学哪些科目?
多谢!
avatar
h*o
3
suppose the I get a http response with header:
"Expires: Mon, 26 Jul 2009 05:00:00 GMT", I need to converts it to timestamp
of the computer's current time?
Thanks.
avatar
m*e
4
ctime

timestamp

【在 h**o 的大作中提到】
: suppose the I get a http response with header:
: "Expires: Mon, 26 Jul 2009 05:00:00 GMT", I need to converts it to timestamp
: of the computer's current time?
: Thanks.

avatar
h*o
5
I think you want me to use strptime(). and I can now get the timestamp by
using
strptime("18 Oct 2008 14:11:00", "%d %b %Y %H:%M:%S", &tm).
but how do I convert GMT time "18 Oct 2008 14:11:00 GMT"to my local
timestamp, no matter where my local computer locates?

【在 m*****e 的大作中提到】
: ctime
:
: timestamp

avatar
h*o
6
我编了一个,没你那么复杂:但不知为何少了一个小时. 我市pacific time, 应该与
GMT 查7小时,但timezone 愣是给减了8小时. 我已经写 tm.tm_isdst = 1 了:
suppose GMT_str = "18 Oct 2008 14:11:00"
extern long timezone;
time_t GMT_2_localtimestamp(char* GMT_str){
struct tm tm;
strptime(GMT_str, "%d %b %Y %H:%M:%S", &tm);
tm.tm_isdst = 1;
time_t gm_t = mktime(&tm);
tzset();
gm_t -= timezone;
return gm_t;
}
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。