Linux时间函数
asctime(将时间和日期以字符串格式表示)
相关函数
time,ctime,gmtime,localtime
表头文件
#include<time.h>
定义函数
char * asctime(const struct tm * timeptr);
函数说明
asctime()将参数timeptr所指的tm结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果以字符串形态返回。此函数已经由时区转换成当地时间,字符串格式为:“Wed Jun 30 21:49:08 1993\n”
返回值
若再调用相关的时间日期函数,此字符串可能会被破坏。此函数与ctime不同处在于传入的参数是不同的结构。
附加说明
返回一字符串表示目前当地的时间日期。
范例
#include <time.h>
main()
{
time_t timep;
time (&timep);
printf(“%s”,asctime(gmtime(&timep)));
}
执行
Sat Oct 28 02:10:06 2000
ctime(将时间和日期以字符串格式表示)
相关函数
time,asctime,gmtime,localtime
表头文件
#include<time.h>
定义函数
char *ctime(const time_t *timep);
函数说明
ctime()
将参数timep所指的time_t结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果以字符串形态返回。此函数已经由时区转换成当地时
间,字符串格式为“Wed Jun 30 21 :49 :08 1993\n”。若再调用相关的时间日期函数,此字符串可能会被破坏。
返回值
返回一字符串表示目前当地的时间日期。
范例
#include<time.h>
main()
{
time_t timep;
time (&timep);
printf(“%s”,ctime(&timep));
}
执行
Sat Oct 28 10 : 12 : 05 2000
gettimeofday(取得目前的时间)
相关函数
time,ctime,ftime,settimeofday
表头文件
#include <sys/time.h>
#include <unistd.h>
定义函数
int gettimeofday (
相关文档:
Linux文件权限基本概述:
1.基本权限:可读(r) 可写(w) 可编辑(x)
2.特殊权限:SUID SGID SBIT
3.隐藏权限:通过[lsattr]查看,[chattr]设置;由于文件的隐藏权限种类较多(13种),在此不作具体说明;可以通过[man ......
SIGHUP 终止进程 终端线路挂断
SIGINT 终止进程 &nb ......
==================网络的基本配置===================
IP地址:网络部分和主机部分
192.168.1.123 255.255.255.0 255=11111111 (255.255.255.192)
192.168.1.234/24 =24个1
网关:计算机在本地网络找不到目标主机时,自动向网关发送数据包
一般是一个路由器或NAT服务器(代理服务器)
......
stat结构的成员在不同的unix中会有所变化.. 但一般都包含以下所示的内容:
St_mode 文件权限和文件类型信息。
st_ino 与该文件关联的inode
st_dev 保存文件的设备
st_uid 文件属主的UID号
st_gid ......
在Linux系统中我一般采用编译源码的方式来安装Apache,有两种方法可以让Apache在系统启动时自动启动。
1. 在/etc/rc.d/rc.local中增加启动apache的命令,例如:/usr/local/httpd/bin/apachectl start
2. 将apache注册为系统服务
首先将apachectl命令拷贝至/etc/rc.d/init.d目录下,改名为httpd
使用编辑器打开httpd文件 ......