当前位置: 技术问答>linux和unix
我用gettimeofday()函数,取得的时区是不是/etc/localtime所设的时区?
来源: 互联网 发布时间:2016-03-27
本文导语: 我在用gettimeofday()时,取得的时区怪怪的。 我先cp/usr/share/zoneinfo/GMT-6 /etc/localtime, 用date查看,时间变成了GMT-6的。 然后调用gettimeofday(&tv,&tz), 得到的tz.tz_minuteswest却还是480??? 先多谢各位...
我在用gettimeofday()时,取得的时区怪怪的。
我先cp/usr/share/zoneinfo/GMT-6 /etc/localtime,
用date查看,时间变成了GMT-6的。
然后调用gettimeofday(&tv,&tz),
得到的tz.tz_minuteswest却还是480???
先多谢各位了!!!
我先cp/usr/share/zoneinfo/GMT-6 /etc/localtime,
用date查看,时间变成了GMT-6的。
然后调用gettimeofday(&tv,&tz),
得到的tz.tz_minuteswest却还是480???
先多谢各位了!!!
|
The use of the timezone structure is obsolete; the tz argument should nor-
mally be specified as NULL. The tz_dsttime field has never been used under
Linux; it has not been and will not be supported by libc or glibc. Each
and every occurrence of this field in the kernel source (other than the
declaration) is a bug. Thus, the following is purely of historic interest.
在linux环境中,tz内的内容请无视之。
mally be specified as NULL. The tz_dsttime field has never been used under
Linux; it has not been and will not be supported by libc or glibc. Each
and every occurrence of this field in the kernel source (other than the
declaration) is a bug. Thus, the following is purely of historic interest.
在linux环境中,tz内的内容请无视之。
|
马甲?
既然是NULL,哪里来的“tz.tz_minuteswest却还是480”?
|
晕,我哪是什么马甲啊
我一般是这么用的
struct .... tv;
gettimeofday(&tv,NULL);
我一般是这么用的
struct .... tv;
gettimeofday(&tv,NULL);
|
我都是用NULL,得到是系统的时间