ºìÁªLinuxÃÅ»§
Linux°ïÖú

LinuxÏ»ñµÃϵͳʱ¼äµÄCÓïÑÔµÄʵÏÖ·½·¨

·¢²¼Ê±¼ä:2005-06-15 00:22:24À´Ô´:ºìÁª×÷Õß:007
LinuxÏ»ñµÃϵͳʱ¼äµÄCÓïÑÔµÄʵÏÖ·½·¨
#include //CÓïÑÔµÄÍ·Îļþ
#include //C﵀I/O

void main()
{
time_t now; //ʵÀý»¯time_t½á¹¹
struct tm *timenow; //ʵÀý»¯tm½á¹¹Ö¸Õë
time(&now);
//timeº¯Êý¶ÁÈ¡ÏÖÔÚµÄʱ¼ä(¹ú¼Ê±ê׼ʱ¼ä·Ç±±¾©Ê±¼ä)£¬È»ºó´«Öµ¸ønow

timenow = localtime(&now);
//localtimeº¯Êý°Ñ´ÓtimeÈ¡µÃµÄʱ¼änow»»Ëã³ÉÄãµçÄÔÖеÄʱ¼ä(¾ÍÊÇÄãÉèÖõĵØÇø)

printf("Local time is %s\n",asctime(timenow));
//ÉϾäÖÐasctimeº¯Êý°Ñʱ¼äת»»³É×Ö·û£¬Í¨¹ýprintf()º¯ÊýÊä³ö
}

×¢ÊÍ£ºtime_tÊÇÒ»¸öÔÚtime.hÖж¨ÒåºÃµÄ½á¹¹Ìå¡£¶øtm½á¹¹ÌåµÄÔ­ÐÎÈçÏ£º

struct tm
{
int tm_sec;//seconds 0-61
int tm_min;//minutes 1-59
int tm_hour;//hours 0-23
int tm_mday;//day of the month 1-31
int tm_mon;//months since jan 0-11
int tm_year;//years from 1900
int tm_wday;//days since Sunday, 0-6
int tm_yday;//days since Jan 1, 0-365
int tm_isdst;//Daylight Saving time indicator
};
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 12 ÌõÆÀÂÛ

  1. Gpoyinsnbo ÓÚ 2007-04-18 10:51:44·¢±í:

    ºÜºÃµÄ£¬Ñ§Ï°ÁË

  2. Linux85fan ÓÚ 2007-03-12 15:08:46·¢±í:

    linuxÖеÄC±à³Ì»¹Õ湻ǿµÄ¡£:0L

  3. waterathena ÓÚ 2007-01-11 14:13:17·¢±í:

    ÎÒÔÚÎÒµÄϵͳϲâÊÔÕâ¸ö¼ò¶ÌµÄ³ÌÐò£¬·¢ÏÖ²»¶Ô°¡¡£ÎÒµÄÏÔʾµÄÊÇ×òÌìµÄÍíÉϵÄʱ¼äÄØ¡£
    °ïæ½â´ðÏÂÄØ£¿¸÷λ¸ßÊÖ

  4. µÂÀï¿Ë ÓÚ 2007-01-05 15:54:13·¢±í:

    ¶àл

  5. jakepain ÓÚ 2007-01-05 12:10:40·¢±í:

    ÎÒÓ¦¸Ã°ÑÕâЩÊäÈëµ½ÄÄÀï?

  6. cxqcxq0177 ÓÚ 2006-12-12 10:15:44·¢±í:

    ѧ¹ýcµÄÓ¦¸Ã¶¼ÖªµÀ°É

  7. mail11758332 ÓÚ 2006-11-15 17:01:38·¢±í:

    :0L

  8. ÓÚ 2006-10-16 18:33:22·¢±í:

    Hallo! Looks good. It's an interesting site
    ah lesbian video http://lesbian-video.lesbians.xxx01.info/
    Thanx! Good luck!

  9. lwinon ÓÚ 2005-11-04 22:17:02·¢±í:

    Ó¦¸Ã¶ÔÎÒÓаïÖú

  10. ·ÉÓ¥ ÓÚ 2005-10-04 00:50:58·¢±í:

    ¸Ðл·¢Ìù

  11. cha ÓÚ 2005-09-05 00:39:55·¢±í:

    Ö§³Ö

  12. yy123 ÓÚ 2005-08-09 00:08:58·¢±í:

    °ï¶¥ÏÂ