Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux ϵͳʱ¼äÉèÖᢱà³Ì×ܽá

δÍê´ýÐø...
ÉèÖÃʱ¼ä£º
date -s "2009/11/08 11:23:00"
Ó²¼þʱÖÓÓëϵͳʱ¼äͬ²½Ò»Ï£º
hwclock --systohc
±à³Ì£º
#include <cstdlib>
time_t time(time_t *timer)
µ÷Óú󽫵±Ç°ÏµÍ³Ê±¼äÓë1900Äê1ÔÂ1ÈÕÏà²îµÄÃëÊý´æÈëµ½timerÖУ¬timer¿É¿´³ÉÊÇÒ»¸ö³¤ÕûÐÍÊý
¾ßÌåÃèÊö£º
  º¯ÊýÔ­ÐÍ£º  time_t  time(time_t  *timer)     
  º¯ÊýÓÃ;£º  µÃµ½»úÆ÷µÄÈÕÀúʱ¼ä»òÕßÉèÖÃÈÕÀúʱ¼ä     
  Í·  ÎÄ  ¼þ£º  time.h   
  ÊäÈë²ÎÊý£º  timer:=NULLʱ£¬µÃµ½»úÆ÷ÈÕÀúʱ¼ä,=ʱ¼äÊýֵʱ  ÓÃÓÚÉèÖÃÈÕÀúʱ¼ä; 
struct tm* localtime(const time_t *timer)
½«time()º¯Êýµ÷ÓõĽá¹û×öΪ²ÎÊý´«Èëµ½localtime()º¯ÊýÖоÍÄܵõ½µ±Ç°Ê±¼äºÍÈÕÆÚ£¬×¢ÒâµÃµ½µÄÄêÊǺÍ1970µÄ²îÖµ£¬Ô·ÝÊǺÍ1ÔµIJîÖµ
struct tmÊÇÒ»¸ö½á¹¹Ì壬¶¨ÒåÈçÏÂ:
struct tm
{
int tm_sec; //µ±Ç°Ãë
int tm_min; //µ±Ç°·ÖÖÓ
int tm_hour; //µ±Ç°Ð¡Ê±
int tm_mday; //µ±Ç°ÔÚ±¾ÔÂÖеÄÌ죬Èç11ÔÂ1ÈÕ£¬ÔòΪ1
int tm_mon; //µ±Ç°Ô£¬·¶Î§ÊÇ0~11
int tm_year; //µ±Ç°ÄêºÍ1900µÄ²îÖµ£¬Èç2006ÄêÔòΪ36
int tm_wday; //µ±Ç°ÔÚ±¾ÐÇÆÚÖеÄÌ죬·¶Î§0~6
int tm_yday; //µ±Ç°ÔÚ±¾ÄêÖеÄÌ죬·¶Î§0~365
int tm_isdst; //Õâ¸öÎÒÒ²²»Çå³þ
}
×¢Ò⣺·µ»ØµÄtm* Ö¸ÏòÒ»¸östaticλÖã¬Ã¿´Îµ÷Ó÷µ»ØµÄ¶¼ÊÇÕâ¸ö¾²Ì¬ÇøÓò£¬ÕâÒ²¾ÍÊDz»ÐèÒªdelete tmµÄÔ­Òò¡£
Çóµ±Ç°Ê±¼äµÄʾÀý
int getSystemTime()
{
time_t timer;
struct tm* t_tm;
time(&timer);
t_tm = localtime(&timer);
printf("today is %4d%02d%02d%02d%02d%02d\n", t_tm.tm_year+1900,
t_tm.tm_mon+1, t_tm.tm_mday, t_tm.tm_hour, t_tm.tm_min, t_tm.tm_sec);
return 0;
}
ÆäËûʱ¼äµÄº¯ÊýºÍ½á¹¹»¹ÓУº
timeval½á¹¹
#include <include/linux/time.h>
struct timeval
{
time_t tv_sec;
susecond_t tv_usec; //µ±Ç°ÃîÄÚµÄ΢ÃîÊý
};
tms½á¹¹
±£´æ×ÅÒ»¸ö½ø³Ì¼°Æä×Ó½ø³ÌʹÓõÄcpuʱ¼ä
struct tms
{
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
}
timer_struct½á¹¹
#include <include/linux/timer.h>
struct timer_struct
{
unsigned long expires; //¶¨Ê±Æ÷±»¼¤»îµÄʱ


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì (Æß) SDPЭÒé

Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖЭÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀЭÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......

Linuxϵͳ³ÌÐòÆô¶¯Òýµ¼¹ý³ÌÏêϸÆÊÎö

 LinuxµÄÒ»¸öÎüÒýÈ˵ÄÌØÐÔ¾ÍÊÇÓû§¿ÉÒÔ×ÔÐж¨ÖÆÕû¸öϵͳ£¬Äã¿ÉÊÇÔËÐÐÒ»¸öÖ»ÓÐ1MµÄ“ÃÔÄã”Linux£¬Ò²¿ÉÒÔÔËÐÐÒ»¸ö¼¸GµÄÇ¿´óLinux¡£¶øÎÞÂÛÄãÔËÐÐÔõÑùµÄLinux£¬Ä㶼ÊÇÏÈ´ÓÒýµ¼³ÌÐò¿ªÊ¼ÔËÐеġ£¶ÔÓÚÆÕͨÓû§£¬´ó¶à¶¼ÊÇÔÚ¸öÈ˵çÄÔÉÏÔËÐÐLinuxµÄ¡£
¡¡¡¡¸öÈ˵çÄÔ£¬ÓÖ½ÐPC»ú£¬ÊÇÎÒÃdz£¼ûµÄʹÓÃIntel»òAMDµÄоƬµÄµç ......

LinuxϵÄʵʱÁ÷ýÌå±à³Ì

 
¼¶±ð£º ³õ¼¶
ФÎÄÅô
(xiaowp@263.net
), ˶ʿÑо¿Éú, ±±¾©Àí¹¤´óѧ¼ÆËã»úϵ
2004 Äê 2 ÔÂ 01 ÈÕ
Á÷
ýÌåÖ¸µÄÊÇÔÚÍøÂçÖÐʹÓÃÁ÷¼¼Êõ´«ÊäµÄÁ¬Ðøʱ»ùýÌ壬ÆäÌصãÊÇÔÚ²¥·ÅÇ°²»ÐèÒªÏÂÔØÕû¸öÎļþ£¬¶øÊDzÉÓñßÏÂÔر߲¥·ÅµÄ·½Ê½£¬ËüÊÇÊÓƵ»áÒé¡¢IPµç»°µÈÓ¦Óó¡ºÏ
µÄ¼¼Êõ»ù´¡¡£RTPÊǽøÐÐʵʱÁ÷ýÌå´«ÊäµÄ±ê׼ЭÒéº ......

linuxÖÐELF¼ÓÔعý³Ì·ÖÎö

sys_execve
   | - do_execve
|
| - search_binary_handler         
           |- linux_binfmt= elf_format
       |- elf_format-> load_elf_binary
| -&nbs ......

LinuxÏ c ÅжÏÒ»¸öÎļþÊÇ·ñ´æÔÚ

#include <stdio.h>
#include <unistd.h>
#define FOO "foo"
int main(void)
{
if(!access(FOO, F_OK))
{
if(!unlink(FOO))
{

}
else
{
printf("remove %s failed\n", FOO);
}
}
else
{
printf("%s not existed\ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ