Linux »ñȡϵͳʱ¼ä
1.ʱ¼ä±íʾ
ÔÚ³ÌÐòµ±ÖÐ,ÎÒÃǾ³£ÒªÊä³öϵͳµ±Ç°µÄʱ¼ä,±ÈÈçÎÒÃÇʹÓÃdateÃüÁîµÄÊä³ö½á¹û¡£Õâ¸öʱºòÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæÁ½¸öº¯Êý
time_t time(time_t *tloc); //ʱ¼ä¾«¶ÈΪÃë
char *ctime(const time_t *clock); //½«ÃëÊýת»¯Îª×Ö·û´®
timeº¯Êý·µ»Ø´Ó1970Äê1ÔÂ1ÈÕ0µãÒÔÀ´µÄÃëÊý[×¢Ò⣬´Ëº¯Êý·µ»ØµÄʱ¼ä¾«¶ÈÊÇ“Ãë”]¡£´æ´¢ÔÚtime_t ½á¹¹Ö®ÖС£²»¹ýÕâ¸öº¯ÊýµÄ·µ»ØÖµ¶ÔÓÚÎÒÃÇÀ´ËµÃ»ÓÐʲôʵ¼ÊÒâÒå¡£Õâ¸öʱºòÎÒÃÇʹÓõڶþ¸öº¯Êý½«ÃëÊýת»¯Îª×Ö·û´®¡£Õâ¸öº¯ÊýµÄ·µ»ØÀàÐÍÊǹ̶¨µÄ:Ò»¸ö¿ÉÄÜֵΪ¡£ thu dec 7 14:58:59 2000 Õâ¸ö×Ö·û´®µÄ³¤¶ÈÊǹ̶¨µÄΪ26
time_tÀàÐÍʵ¼ÊÉÏÊÇÓÉtypedef¶¨ÒåµÄ£¬²¢²»ÊÇÒ»¸öÐÂÀàÐÍ£¬¶ÔÓÚ¶àÊýϵͳÀ´Ëµ£¬time_t¾ÍÊÇlong£¬¾ßÌå×Ô¼ºÊ¹ÓõÄϵͳÊÇÓÉÄÄÖÖÀàÐÍÅÉÉúµÄ£¬¿ÉÒÔÔÚtime.hÍ·ÎļþÀïÓÃtime_t×÷ΪÌõ¼þ²éÒ»²é¾ÍÖªµÀÁË¡£
ÀàËÆµÄ£¬size_tÒ²ÊÇͬÑùµÄµÀÀí¡£
ÁíÍ⣺
struct tm * gmtime(const time_t *timer);
gmtime()º¯ÊýÊǽ«ÈÕÀúʱ¼äת»¯ÎªÊÀ½ç±ê׼ʱ¼ä£¨¼´¸ñÁÖÄáÖÎʱ¼ä£©£¬²¢·µ»ØÒ»¸ötm½á¹¹ÌåÀ´±£´æÕâ¸öʱ¼ä
struct tm * localtime(const time_t * timer);
localtime()º¯ÊýÊǽ«ÈÕÀúʱ¼äת»¯Îª±¾µØÊ±¼ä
ʾÀý´úÂ룺
#include <time.h> //×¢£º²»ÊÇ<sys/time.h> ·ñÔò±àÒë²»±¨´í£¬µ«ÔËÐб¨¶Î´íÎó
#include <stdio.h>
int main()
{
time_t now;
now = time(NULL);
printf("%s", ctime(&now));
return 0;
}
Êä³ö£º
Tue Jun 26 16:29:18 2007
Ö¸¶¨Ê±¼äµÄ·½·¨£º
#include "time.h"
#include "stdio.h"
#include "stdlib.h"
int main(void)
{
struct tm t; //¶¨Òåtmʱ¼ä½á¹¹£¬ÓÃÀ´´æ´¢Ê±¼ä¸ñʽµÄÊý¾ÝÐÅÏ¢
time_t t_of_day; //¶¨Òåtime_tʱ¼ä½á¹¹
t.tm_year=2006-1900;//ÒÔ1900ÄêΪ±ê×¼¼ÆËãʱ¼ä
t.tm_mon=6; //Ϊ½á¹¹Ìå³ÉÔ±¸³Öµ
t.tm_mday=1;
t.tm_hour=0;
t.tm_min=0;
t.tm_sec=1;
t.tm_isdst=0;
t_of_day=mktime(&t);//ʹÓÃm
Ïà¹ØÎĵµ£º
ÔÚLinuxÖÐÖ´ÐÐ.sh½Å±¾£¬Òì³£/bin/sh^M
www.firnow.com ʱ¼ä £º 2009-07-29 ×÷ÕߣºÄäÃû ±à¼£ºtoman µã»÷£º 199 [ ÆÀÂÛ ]
-
-
ÔÚLinuxÖÐÖ´ÐÐ.sh½Å±¾£¬Òì³£/bin/sh^M: bad interpreter: No such file or directory¡£
·ÖÎö£ºÕâÊDz»Í¬ÏµÍ³±àÂë¸ñʽÒýÆðµÄ£ºÔÚwindowsÏ ......
ÄãÕýÔÚÕÒһЩ¸ßÖÊÁ¿µÄLinux ºÍ UNIX µÄ½Ì³ÌÂð£¿Èç¹ûÊÇ£¬ÕâÆªÎÄÕÂ»á¸æËßÄãµ½ÄÄÈ¥ÕÒµ½ÕâЩ½Ì³Ì¡£ÕâÀïÎÒÃǽ«¸ø³ö³¬¹ý30¸öÏ൱µÄ²»´íµÄ
Linux ºÍ UNIX ÔÚÏߵĽ̡̳£
ÐèÒª´ó¼Ò×¢ÒâµÄÊÇ£¬ËûÃǶ¼ÊÇÓ¢Îĵģ¬Ò²ÐíÓÐһЩҲ¾±»·Òëµ½ÁËÖÐÎÄÉçÇø£¬Äã¿ÉÒÔËÑË÷һϡ£µ«²»¹ÜÔõôÑù£¬ÎҵĽ¨ÒéÊÇÓ¦¸Ã¾¡¿ÉÄܵÄÈ¥ÔĶÁÓ¢ÎÄ¡£
Lin ......
GCC ÖÐÎÄÊÖ²á
¡¡¡¡http://www.nbfan.com/forum/dispbbs....&ID=1433&page=1
¡¡¡¡GNU make Ö¸ÄÏ
¡¡¡¡http://www.linuxsir.org/bbs/showthr...&threadid=40431
¡¡¡¡autoc ......
linuxĿ¼¼Ü¹¹
/ ¸ùĿ¼
/bin ³£ÓõÄÃüÁî binary file µÄÄ¿錄
/boot ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ (kernel) ÔÚÄÚ
/boot/grub/menu.lst GRUBÉèÖÃ
/boot/vmlinuz ÄÚºË
/boot/initrd ºËÐĽâ壓縮ËùÐè RAM Disk
/dev ϵͳÖܱßÉ豸
/etc ......
ÕªÒª:±¾Õ½«Ïò¶ÁÕßÒÀ´Î½âÊÍÖжϸÅÄ½âÎöLinuxÖеÄÖжÏʵÏÖ»úÀíÒÔ¼°LinuxÏÂÖжÏÈçºÎ±»Ê¹Óá£×÷ΪʵÀýÎÒÃǵÚÒ»½«Ïò¡¶i386Ìåϵ½á¹¹¡·Ò»ÕÂÖдòÔìµÄϵͳ¼ÓÈëÒ»¸öʱÖÓÖжϣ»µÚ¶þ½«Îª´ó¼Ò×¢½âRTCÖжϣ¬Ï£Íûͨ¹ýÕâÁ½¸öʵÀý¿ÉÒÔ°ïÖú¶ÁÕßÕÆÎÕÖжÏÏà¹ØµÄ¸ÅÄʵÏֺͱà³Ì·½·¨¡£
ÖжÏÊÇʲô
ÖжϵĺºÓï½âÊÍÊǰëÖм䷢Éú×è¸ô¡¢Í£¶Ù»ò ......