由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - how to convert GMT to timestamp of the computer's current time
相关主题
any tool to recommend to port c++ code from windows to linuxis it possible use VC 6.0 library file in .net
which header file declares ntohs() in c++ ?why int** cannot convert to const int** ?
perl sprintf question converting dec to hexHow to conver CString to long long type?
你大爷的夏日制!!Help with a c++ const variable
url header问题在C里面怎么验证一个input数字是不是超过int的范围?
[合集] 超强的bugHow to write a VB Macro to convert text to hyperlink in Excel
auto_ptr_array.h 疑问C, how is a string cast into a int?
timezone questionNew "KENG" about Perl.
相关话题的讨论汇总
话题: gmt话题: timestamp话题: time话题: computer话题: convert
进入Programming版参与讨论
1 (共1页)
h**o
发帖数: 548
1
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.
m*****e
发帖数: 4193
2
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.

h**o
发帖数: 548
3
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

h**o
发帖数: 548
4
我编了一个,没你那么复杂:但不知为何少了一个小时. 我市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;
}
1 (共1页)
进入Programming版参与讨论
相关主题
New "KENG" about Perl.url header问题
how to convert an integer to a widestring[合集] 超强的bug
convert mapped drive letter to full path in vbscript (转载)auto_ptr_array.h 疑问
how to convert str to doubletimezone question
any tool to recommend to port c++ code from windows to linuxis it possible use VC 6.0 library file in .net
which header file declares ntohs() in c++ ?why int** cannot convert to const int** ?
perl sprintf question converting dec to hexHow to conver CString to long long type?
你大爷的夏日制!!Help with a c++ const variable
相关话题的讨论汇总
话题: gmt话题: timestamp话题: time话题: computer话题: convert