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 (
相关文档:
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
Linux文件权限基本概述:
1.基本权限:可读(r) 可写(w) 可编辑(x)
2.特殊权限:SUID SGID SBIT
3.隐藏权限:通过[lsattr]查看,[chattr]设置;由于文件的隐藏权限种类较多(13种),在此不作具体说明;可以通过[man ......
SIGHUP 终止进程 终端线路挂断
SIGINT 终止进程 &nb ......
stat结构的成员在不同的unix中会有所变化.. 但一般都包含以下所示的内容:
St_mode 文件权限和文件类型信息。
st_ino 与该文件关联的inode
st_dev 保存文件的设备
st_uid 文件属主的UID号
st_gid ......
本文转载于: http://hi.baidu.com/peruke/blog/item/b8de06ec6a04583b27979132.html
tzset
#incude <time.h
>
void tzset(void);
设置时间环境变量。
说明
tzset()函数使用环境变量TZ的当前设置把值赋给三个全局变量:daylight,timezone和tzname。
这些变量由ftime和localtime函数使用校正格林威治(UTC ......