Python论坛  - 讨论区

标题:[python-chinese] C的系统函数gmtime取到的是什么时间

2007年09月07日 星期五 15:23

Geoffery>>>嘎瑞>>>XuLi geofferyli在gmail.com
星期五 九月 7 15:23:31 HKT 2007

ÏÖÔÚÔÚUNIXϵͳÖÐҪȡµ½ÏµÍ³Ê±¼ä¡£
ÁÙ³¿Ö´ÐÐbatch£¬µ«ÊÇÈ¡µ½Ê±¼äºÃÏñ²»Êǵ±ÌìµÄʱ¼ä¡£


-- 
-------------------------------------------------------------------
python-chinese list
PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
Í˶©: ·¢ËÍ unsubscribe µ½  python-chinese-request在lists.python.cn
Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070907/52c2734c/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 15:28

LI Xin delphij在delphij.net
星期五 九月 7 15:28:01 HKT 2007

Geoffery>>>¸ÂÈð>>>XuLi wrote:
> ÏÖÔÚÔÚUNIXϵͳÖÐҪȡµ½ÏµÍ³Ê±¼ä¡£
> ÁÙ³¿Ö´ÐÐbatch£¬µ«ÊÇÈ¡µ½Ê±¼äºÃÏñ²»Êǵ±ÌìµÄʱ¼ä¡£

´ÓUNIX´ó¼ÍÔª(1970Äê1ÔÂ1ÈÕ UTC 00:00:00)¿ªÊ¼µÄÃëÊý¡£

²»¹ýPythonÌṩµÄʱ¼äº¯Êý¿ÉÒÔÖ±½Óת»»³ÉÈËÀà¿É¶ÁµÄÐÎʽ°¡£¿

Cheers,
-- 
Xin LI <delphij在delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!

-------------- 下一部分 --------------
Ò»¸ö·ÇÎı¾¸½¼þ±»Çå³ý...
·¢ÐÅÈË: %(who)s
Ö÷Ìâ: %(subject)s
ÈÕÆÚ: %(date)s
´óС: 249
Url: http://python.cn/pipermail/python-chinese/attachments/20070907/48edee70/attachment-0001.pgp 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 15:28

Geoffery>>>嘎瑞>>>XuLi geofferyli在gmail.com
星期五 九月 7 15:28:27 HKT 2007

ÎÊÌâÇå³þÁË£¬gmtimeÈ¡µÃµÄÊǸñÁÖÄáÖÎʱ¼ä¡£
Èç¹ûҪȥϵͳµ±µØʱ¼ä±ØÐëÒªÓÃlocaltime¡£


On 9/7/07, Geoffery>>>¸ÂÈð>>>XuLi <geofferyli在gmail.com> wrote:
>
> ÏÖÔÚÔÚUNIXϵͳÖÐҪȡµ½ÏµÍ³Ê±¼ä¡£
> ÁÙ³¿Ö´ÐÐbatch£¬µ«ÊÇÈ¡µ½Ê±¼äºÃÏñ²»Êǵ±ÌìµÄʱ¼ä¡£
>
>
> --
> -------------------------------------------------------------------
> python-chinese list
> PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
> ·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
> ¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
> Í˶©: ·¢ËÍ unsubscribe µ½  python-chinese-request在lists.python.cn
> Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
>



-- 
-------------------------------------------------------------------
python-chinese list
PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
Í˶©: ·¢ËÍ unsubscribe µ½  python-chinese-request在lists.python.cn
Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070907/2d0dd593/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 16:41

Geoffery>>>嘎瑞>>>XuLi geofferyli在gmail.com
星期五 九月 7 16:41:56 HKT 2007

Ò»ÏÂÕâ¶Î´úÂ룬ΪʲôÓÃgmtimeºÍlocaltimeÈ¡µÃµÄʱ¼äÊÇÒ»ÑùµÄ£¿


#include 
#include 

int main(void)
{
   time_t timer;
   struct tm *jt;
   struct tm *gt;

   time(&timer;);

   /* ¬FÔڕr¿Ì¤ò¥°¥ê¥Ë¥Ã¥¸•rég¤Ë‰ä“Q */
   gt = gmtime(&timer;);
   printf("¥°¥ê¥Ë¥Ã¥¸•rég\n");
   printf("Äê  : %d\n",gt->tm_year+1900);
   printf("ÔÂ  : %d\n",gt->tm_mon+1);
   printf("ÈÕ  : %d\n",gt->tm_mday);
   printf("•r  : %d\n",gt->tm_hour);
   printf("·Ö  : %d\n",gt->tm_min);
   printf("Ãë  : %d\n",gt->tm_sec);

   /* ¬FÔڕr¿Ì¤òÈÕ±¾•rég¤Ë‰ä“Q */
   jt = localtime(&timer;);
   printf("\nÈÕ±¾•rég\n");
   printf("Äê  : %d\n",jt->tm_year+1900);
   printf("ÔÂ  : %d\n",jt->tm_mon+1);
   printf("ÈÕ  : %d\n",jt->tm_mday);
   printf("•r  : %d\n",jt->tm_hour);
   printf("·Ö  : %d\n",jt->tm_min);
   printf("Ãë  : %d\n",jt->tm_sec);

   return 0;
}



On 9/7/07, LI Xin <delphij在delphij.net> wrote:
>
> Geoffery>>>¸ÂÈð>>>XuLi wrote:
> > ÏÖÔÚÔÚUNIXϵͳÖÐҪȡµ½ÏµÍ³Ê±¼ä¡£
> > ÁÙ³¿Ö´ÐÐbatch£¬µ«ÊÇÈ¡µ½Ê±¼äºÃÏñ²»Êǵ±ÌìµÄʱ¼ä¡£
>
> ´ÓUNIX´ó¼ÍÔª(1970Äê1ÔÂ1ÈÕ UTC 00:00:00)¿ªÊ¼µÄÃëÊý¡£
>
> ²»¹ýPythonÌṩµÄʱ¼äº¯Êý¿ÉÒÔÖ±½Óת»»³ÉÈËÀà¿É¶ÁµÄÐÎʽ°¡£¿
>
> Cheers,
> --
> Xin LI <delphij在delphij.net>    http://www.delphij.net/
> FreeBSD - The Power to Serve!
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
-------------------------------------------------------------------
python-chinese list
PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
Í˶©: ·¢ËÍ unsubscribe µ½  python-chinese-request在lists.python.cn
Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070907/09310040/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 16:55

LI Xin delphij在delphij.net
星期五 九月 7 16:55:06 HKT 2007

Geoffery>>>嘎瑞>>>XuLi wrote:
> 一下这段代码,为什么用gmtime和localtime取得的时间是一样的?

因为你的本地时区设置和系统时钟的时间是一样的(我个人认为这个是不对的,但
Windows和一些其他操作系统确实会这样做),或者你在伦敦。

localtime()会把纪元时间转换为本地时间。

gmtime()会把纪元时间转换为系统时钟表达的时间,而不做时区转换。

Cheers,
-- 
Xin LI <delphij在delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!

-------------- 下一部分 --------------
一个非文本附件被清除...
发信人: %(who)s
主题: %(subject)s
日期: %(date)s
大小: 249
Url: http://python.cn/pipermail/python-chinese/attachments/20070907/dd082565/attachment.pgp 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 17:15

Geoffery>>>嘎瑞>>>XuLi geofferyli在gmail.com
星期五 九月 7 17:15:02 HKT 2007

Ä¿Ç°²âÊÔ»·¾³UNIX»·¾³£¬ TZ=Japan
ÏÖÔÚµÄÎÊÌâÈçÏ£º

code 1£º
gt = gmtime(&timer;);
   printf("¥°¥ê¥Ë¥Ã¥¸•rég\n");
   printf("Äê  : %d\n",gt->tm_year+1900);
   printf("ÔÂ  : %d\n",gt->tm_mon+1);
   printf("ÈÕ  : %d\n",gt->tm_mday);
   printf("•r  : %d\n",gt->tm_hour);
   printf("·Ö  : %d\n",gt->tm_min);
   printf("Ãë  : %d\n",gt->tm_sec);

code 2£º
printf("%d%d%d%d%d%d",gt->tm_year+1900£¬gt->tm_mon+1£¬ gt->tm_mday£¬
gt->tm_hour£¬ gt->tm_min£¬gt->tm_sec );


code1È¡µÃµÄÊǺÍlocaltimeÒ»ÑùµÄʱ¼ä£¨Ö÷Òª±íÏÖÔÚʱ¼äÉÏ£©,²¢Ã»Óвî9¸öСʱ¡£
code2È¡µÃÊǸñÁÖÄáÖÎʱ¼ä£¬ÓëlocaltimeÈ¡µÃʱ¼ä²î9¸öСʱ¡£

Áí£¬ÏµÍ³Ê±ÖÓÈçºÎ¼ÆËãµÄ£¿

лл

On 9/7/07, LI Xin <delphij在delphij.net> wrote:
>
> Geoffery>>>¸ÂÈð>>>XuLi wrote:
> > Ò»ÏÂÕâ¶Î´úÂ룬ΪʲôÓÃgmtimeºÍlocaltimeÈ¡µÃµÄʱ¼äÊÇÒ»ÑùµÄ£¿
>
> ÒòΪÄãµÄ±¾µØʱÇøÉèÖúÍϵͳʱÖÓµÄʱ¼äÊÇÒ»ÑùµÄ£¨ÎÒ¸öÈËÈÏΪÕâ¸öÊDz»¶ÔµÄ£¬µ«
> WindowsºÍһЩÆäËû²Ù×÷ϵͳȷʵ»áÕâÑù×ö£©£¬»òÕßÄãÔÚÂ׶ء£
>
> localtime()»á°Ñ¼ÍԪʱ¼äת»»Îª±¾µØʱ¼ä¡£
>
> gmtime()»á°Ñ¼ÍԪʱ¼äת»»ÎªÏµÍ³Ê±ÖÓ±í´ïµÄʱ¼ä£¬¶ø²»×öʱÇøת»»¡£
>
> Cheers,
> --
> Xin LI <delphij在delphij.net>    http://www.delphij.net/
> FreeBSD - The Power to Serve!
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
-------------------------------------------------------------------
python-chinese list
PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
Í˶©: ·¢ËÍ unsubscribe µ½  python-chinese-request在lists.python.cn
Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070907/90183eea/attachment-0001.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 18:35

Geoffery>>>嘎瑞>>>XuLi geofferyli在gmail.com
星期五 九月 7 18:35:34 HKT 2007

Ä¿Ç°²âÊÔ»·¾³UNIX»·¾³£¬ TZ=Japan
ÏÖÔÚµÄÎÊÌâÈçÏ£º

code 1£º
gt = gmtime(&timer;);
   printf("¥°¥ê¥Ë¥Ã¥¸•rég\n");
   printf("Äê  : %d\n",gt->tm_year+1900);
   printf("ÔÂ  : %d\n",gt->tm_mon+1);
   printf("ÈÕ  : %d\n",gt->tm_mday);
   printf("•r  : %d\n",gt->tm_hour);
   printf("·Ö  : %d\n",gt->tm_min);
   printf("Ãë  : %d\n",gt->tm_sec);

code 2£º
printf("%d%d%d%d%d%d",gt->tm_year+1900£¬gt->tm_mon+1£¬ gt->tm_mday£¬
gt->tm_hour£¬ gt->tm_min£¬gt->tm_sec );


code1È¡µÃµÄÊǺÍlocaltimeÒ»ÑùµÄʱ¼ä£¨Ö÷Òª±íÏÖÔÚʱ¼äÉÏ£©,²¢Ã»Óвî9¸öСʱ¡£
code2È¡µÃÊǸñÁÖÄáÖÎʱ¼ä£¬ÓëlocaltimeÈ¡µÃʱ¼ä²î9¸öСʱ¡£

Áí£¬ÏµÍ³Ê±ÖÓÈçºÎ¼ÆËãµÄ£¿

лл



On 9/7/07, LI Xin <delphij在delphij.net> wrote:
>
> Geoffery>>>¸ÂÈð>>>XuLi wrote:
> > Ò»ÏÂÕâ¶Î´úÂ룬ΪʲôÓÃgmtimeºÍlocaltimeÈ¡µÃµÄʱ¼äÊÇÒ»ÑùµÄ£¿
>
> ÒòΪÄãµÄ±¾µØʱÇøÉèÖúÍϵͳʱÖÓµÄʱ¼äÊÇÒ»ÑùµÄ£¨ÎÒ¸öÈËÈÏΪÕâ¸öÊDz»¶ÔµÄ£¬µ«
> WindowsºÍһЩÆäËû²Ù×÷ϵͳȷʵ»áÕâÑù×ö£©£¬»òÕßÄãÔÚÂ׶ء£
>
> localtime()»á°Ñ¼ÍԪʱ¼äת»»Îª±¾µØʱ¼ä¡£
>
> gmtime()»á°Ñ¼ÍԪʱ¼äת»»ÎªÏµÍ³Ê±ÖÓ±í´ïµÄʱ¼ä£¬¶ø²»×öʱÇøת»»¡£
>
> Cheers,
> --
> Xin LI <delphij在delphij.net>    http://www.delphij.net/
> FreeBSD - The Power to Serve!
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
-------------------------------------------------------------------
python-chinese list
PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
Í˶©: ·¢ËÍ unsubscribe µ½  python-chinese-request在lists.python.cn
Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070907/341e0c18/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 19:47

Alec huanghao.c在gmail.com
星期五 九月 7 19:47:02 HKT 2007

UTC

Geoffery>>>¸ÂÈð>>>XuLi дµÀ:
> Ä¿Ç°²âÊÔ»·¾³UNIX»·¾³£¬ TZ=Japan
> ÏÖÔÚµÄÎÊÌâÈçÏ£º
> code 1£º
> gt = gmtime(&timer;);
> printf("¥°¥ê¥Ë¥Ã¥¸•rég\n");
> printf("Äê : %d\n",gt->tm_year+1900);
> printf("ÔÂ : %d\n",gt->tm_mon+1);
> printf("ÈÕ : %d\n",gt->tm_mday);
> printf("•r : %d\n",gt->tm_hour);
> printf("·Ö : %d\n",gt->tm_min);
> printf("Ãë : %d\n",gt->tm_sec);
> code 2£º
> printf("%d%d%d%d%d%d",gt->tm_year+1900£¬gt->tm_mon+1£¬ gt->tm_mday£¬
> gt->tm_hour£¬ gt->tm_min£¬gt->tm_sec );
>
> code1È¡µÃµÄÊǺÍlocaltimeÒ»ÑùµÄʱ¼ä£¨Ö÷Òª±íÏÖÔÚʱ¼äÉÏ£©,²¢Ã»Óвî9¸öСʱ¡£
> code2È¡µÃÊǸñÁÖÄáÖÎʱ¼ä£¬ÓëlocaltimeÈ¡µÃʱ¼ä²î9¸öСʱ¡£
> Áí£¬ÏµÍ³Ê±ÖÓÈçºÎ¼ÆËãµÄ£¿
> лл
>
>
> On 9/7/07, *LI Xin* <delphij at delphij.net delphij at delphij.net>>
> wrote:
>
>     Geoffery> >>¸ÂÈð>>>XuLi wrote:
>     > Ò»ÏÂÕâ¶Î´úÂ룬ΪʲôÓÃgmtimeºÍlocaltimeÈ¡µÃµÄʱ¼äÊÇÒ»ÑùµÄ£¿
>
>     ÒòΪÄãµÄ±¾µØʱÇøÉèÖúÍϵͳʱÖÓµÄʱ¼äÊÇÒ»ÑùµÄ£¨ÎÒ¸öÈËÈÏΪÕâ¸öÊDz»¶Ô
>     µÄ£¬µ«
>     WindowsºÍһЩÆäËû²Ù×÷ϵͳȷʵ»áÕâÑù×ö£©£¬»òÕßÄãÔÚÂ׶ء£
>
>     localtime()»á°Ñ¼ÍԪʱ¼äת»»Îª±¾µØʱ¼ä¡£
>
>     gmtime()»á°Ñ¼ÍԪʱ¼äת»»ÎªÏµÍ³Ê±ÖÓ±í´ïµÄʱ¼ä£¬¶ø²»×öʱÇøת»»¡£
>
>     Cheers,
>     --
>     Xin LI <delphij at delphij.net delphij at delphij.net>>
>     http://www.delphij.net/
>     FreeBSD - The Power to Serve!
>
>
>     _______________________________________________
>     python-chinese
>     Post: send python-chinese at lists.python.cn
>     python-chinese at lists.python.cn>
>     Subscribe: send subscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Unsubscribe: send unsubscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> -- 
> -------------------------------------------------------------------
> python-chinese list
> PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
> ·¢ÑÔ: ·¢Óʼþµ½ python-chinese at lists.python.cn
> python-chinese at lists.python.cn>
> ¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request at lists.python.cn
> python-chinese-request at lists.python.cn>
> Í˶©: ·¢ËÍ unsubscribe µ½ python-chinese-request at lists.python.cn
> python-chinese-request at lists.python.cn>
> Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 20:06

Alec huanghao.c在gmail.com
星期五 九月 7 20:06:18 HKT 2007

Õâ¸ö¡£¡£¡£Õâ¸ö£¬ º¹£¬£¬ÒÔΪ×ß´íÓʼþÁÐ±í£¬
ÕâÀïòËÆÊÇ Python list? :)

gmtime ¸ñʽ»¯Ò»¸öʱ¼ä½á¹¹Îª UTC ʱ¼ä£¬
localtime ¸ñʽ»¯Îª±¾µØʱ¼ä£¬

ÄãÕâ¸ö code1 ºÍ code2 µÄ timer ÊÇÓÃʲô·½·¨È¡À´µÄ£¿
--> gt = gmtime(&timer;);

code2 µÄ gt ÓÖÊÇÓÃʲô¸ñʽ»¯µÄ£¿localtime()?

gmtime Ϊ UTC. ÔÚÖйúµÄ»°£¬¿Ï¶¨±È localtime È¡µÄ´ó 8 ¸öСʱ(³ý·ÇÄǸö
¡°timer¡± ²»ÕýÈ·)¡£


Geoffery>>>¸ÂÈð>>>XuLi дµÀ:
> Ä¿Ç°²âÊÔ»·¾³UNIX»·¾³£¬ TZ=Japan
> ÏÖÔÚµÄÎÊÌâÈçÏ£º
> code 1£º
> gt = gmtime(&timer;);
> printf("¥°¥ê¥Ë¥Ã¥¸•rég\n");
> printf("Äê : %d\n",gt->tm_year+1900);
> printf("ÔÂ : %d\n",gt->tm_mon+1);
> printf("ÈÕ : %d\n",gt->tm_mday);
> printf("•r : %d\n",gt->tm_hour);
> printf("·Ö : %d\n",gt->tm_min);
> printf("Ãë : %d\n",gt->tm_sec);
> code 2£º
> printf("%d%d%d%d%d%d",gt->tm_year+1900£¬gt->tm_mon+1£¬ gt->tm_mday£¬
> gt->tm_hour£¬ gt->tm_min£¬gt->tm_sec );
>
> code1È¡µÃµÄÊǺÍlocaltimeÒ»ÑùµÄʱ¼ä£¨Ö÷Òª±íÏÖÔÚʱ¼äÉÏ£©,²¢Ã»Óвî9¸öСʱ¡£
> code2È¡µÃÊǸñÁÖÄáÖÎʱ¼ä£¬ÓëlocaltimeÈ¡µÃʱ¼ä²î9¸öСʱ¡£
> Áí£¬ÏµÍ³Ê±ÖÓÈçºÎ¼ÆËãµÄ£¿
> лл
>
>
> On 9/7/07, *LI Xin* <delphij at delphij.net delphij at delphij.net>>
> wrote:
>
>     Geoffery> >>¸ÂÈð>>>XuLi wrote:
>     > Ò»ÏÂÕâ¶Î´úÂ룬ΪʲôÓÃgmtimeºÍlocaltimeÈ¡µÃµÄʱ¼äÊÇÒ»ÑùµÄ£¿
>
>     ÒòΪÄãµÄ±¾µØʱÇøÉèÖúÍϵͳʱÖÓµÄʱ¼äÊÇÒ»ÑùµÄ£¨ÎÒ¸öÈËÈÏΪÕâ¸öÊDz»¶Ô
>     µÄ£¬µ«
>     WindowsºÍһЩÆäËû²Ù×÷ϵͳȷʵ»áÕâÑù×ö£©£¬»òÕßÄãÔÚÂ׶ء£
>
>     localtime()»á°Ñ¼ÍԪʱ¼äת»»Îª±¾µØʱ¼ä¡£
>
>     gmtime()»á°Ñ¼ÍԪʱ¼äת»»ÎªÏµÍ³Ê±ÖÓ±í´ïµÄʱ¼ä£¬¶ø²»×öʱÇøת»»¡£
>
>     Cheers,
>     --
>     Xin LI <delphij at delphij.net delphij at delphij.net>>
>     http://www.delphij.net/
>     FreeBSD - The Power to Serve!
>
>
>     _______________________________________________
>     python-chinese
>     Post: send python-chinese at lists.python.cn
>     python-chinese at lists.python.cn>
>     Subscribe: send subscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Unsubscribe: send unsubscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> -- 
> -------------------------------------------------------------------
> python-chinese list
> PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
> ·¢ÑÔ: ·¢Óʼþµ½ python-chinese at lists.python.cn
> python-chinese at lists.python.cn>
> ¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request at lists.python.cn
> python-chinese-request at lists.python.cn>
> Í˶©: ·¢ËÍ unsubscribe µ½ python-chinese-request at lists.python.cn
> python-chinese-request at lists.python.cn>
> Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年09月07日 星期五 20:13

Geoffery>>>嘎瑞>>>XuLi geofferyli在gmail.com
星期五 九月 7 20:13:10 HKT 2007

²»ºÃÒâ˼£¬Ã»ÓÐ˵Çå³þ¡£
code1ºÍcode2¶¼ÊǵÄʱ¼ä¶¼ÊÇͨ¹ýgt = gmtime(&timer;);È¡µÃ£¡

µ«ÊÇΪʲôÏÔʾµÄСʱ²»Ò»ÑùÄØ£¿

ºÜÆæ¹Ö


On 9/7/07, Alec <huanghao.c在gmail.com> wrote:
>
> Õâ¸ö¡£¡£¡£Õâ¸ö£¬ º¹£¬£¬ÒÔΪ×ß´íÓʼþÁÐ±í£¬
> ÕâÀïòËÆÊÇ Python list? :)
>
> gmtime ¸ñʽ»¯Ò»¸öʱ¼ä½á¹¹Îª UTC ʱ¼ä£¬
> localtime ¸ñʽ»¯Îª±¾µØʱ¼ä£¬
>
> ÄãÕâ¸ö code1 ºÍ code2 µÄ timer ÊÇÓÃʲô·½·¨È¡À´µÄ£¿
> --> gt = gmtime(&timer;);
>
> code2 µÄ gt ÓÖÊÇÓÃʲô¸ñʽ»¯µÄ£¿localtime()?
>
> gmtime Ϊ UTC. ÔÚÖйúµÄ»°£¬¿Ï¶¨±È localtime È¡µÄ´ó 8 ¸öСʱ(³ý·ÇÄǸö
> "timer" ²»ÕýÈ·)¡£
>
>
> Geoffery>>>¸ÂÈð>>>XuLi дµÀ:
> > Ä¿Ç°²âÊÔ»·¾³UNIX»·¾³£¬ TZ=Japan
> > ÏÖÔÚµÄÎÊÌâÈçÏ£º
> > code 1£º
> > gt = gmtime(&timer;);
> > printf("¥°¥ê¥Ë¥Ã¥¸•rég\n");
> > printf("Äê : %d\n",gt->tm_year+1900);
> > printf("ÔÂ : %d\n",gt->tm_mon+1);
> > printf("ÈÕ : %d\n",gt->tm_mday);
> > printf("•r : %d\n",gt->tm_hour);
> > printf("·Ö : %d\n",gt->tm_min);
> > printf("Ãë : %d\n",gt->tm_sec);
> > code 2£º
> > printf("%d%d%d%d%d%d",gt->tm_year+1900£¬gt->tm_mon+1£¬ gt->tm_mday£¬
> > gt->tm_hour£¬ gt->tm_min£¬gt->tm_sec );
> >
> > code1È¡µÃµÄÊǺÍlocaltimeÒ»ÑùµÄʱ¼ä£¨Ö÷Òª±íÏÖÔÚʱ¼äÉÏ£©,²¢Ã»Óвî9¸öСʱ¡£
> > code2È¡µÃÊǸñÁÖÄáÖÎʱ¼ä£¬ÓëlocaltimeÈ¡µÃʱ¼ä²î9¸öСʱ¡£
> > Áí£¬ÏµÍ³Ê±ÖÓÈçºÎ¼ÆËãµÄ£¿
> > лл
> >
> >
> > On 9/7/07, *LI Xin* <delphij在delphij.net delphij在delphij.net>>
> > wrote:
> >
> >     Geoffery> >>¸ÂÈð>>>XuLi wrote:
> >     > Ò»ÏÂÕâ¶Î´úÂ룬ΪʲôÓÃgmtimeºÍlocaltimeÈ¡µÃµÄʱ¼äÊÇÒ»ÑùµÄ£¿
> >
> >     ÒòΪÄãµÄ±¾µØʱÇøÉèÖúÍϵͳʱÖÓµÄʱ¼äÊÇÒ»ÑùµÄ£¨ÎÒ¸öÈËÈÏΪÕâ¸öÊDz»¶Ô
> >     µÄ£¬µ«
> >     WindowsºÍһЩÆäËû²Ù×÷ϵͳȷʵ»áÕâÑù×ö£©£¬»òÕßÄãÔÚÂ׶ء£
> >
> >     localtime()»á°Ñ¼ÍԪʱ¼äת»»Îª±¾µØʱ¼ä¡£
> >
> >     gmtime()»á°Ñ¼ÍԪʱ¼äת»»ÎªÏµÍ³Ê±ÖÓ±í´ïµÄʱ¼ä£¬¶ø²»×öʱÇøת»»¡£
> >
> >     Cheers,
> >     --
> >     Xin LI <delphij在delphij.net delphij在delphij.net>>
> >     http://www.delphij.net/
> >     FreeBSD - The Power to Serve!
> >
> >
> >     _______________________________________________
> >     python-chinese
> >     Post: send python-chinese在lists.python.cn
> >     python-chinese在lists.python.cn>
> >     Subscribe: send subscribe to
> >     python-chinese-request在lists.python.cn
> >     python-chinese-request在lists.python.cn>
> >     Unsubscribe: send unsubscribe to
> >     python-chinese-request在lists.python.cn
> >     python-chinese-request在lists.python.cn>
> >     Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > python-chinese list
> > PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
> > ·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
> > python-chinese在lists.python.cn>
> > ¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
> > python-chinese-request在lists.python.cn>
> > Í˶©: ·¢ËÍ unsubscribe µ½ python-chinese-request在lists.python.cn
> > python-chinese-request在lists.python.cn>
> > Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
-------------------------------------------------------------------
python-chinese list
PythonÖÐÎļ¼ÊõÌÖÂÛÓʼþÁбí
·¢ÑÔ: ·¢Óʼþµ½ python-chinese在lists.python.cn
¶©ÔÄ: ·¢ËÍ subscribe µ½ python-chinese-request在lists.python.cn
Í˶©: ·¢ËÍ unsubscribe µ½  python-chinese-request在lists.python.cn
Ïêϸ˵Ã÷: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070907/4a9ddf21/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号