易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux中的延时函数及获取系统时间函数

应用层:
   #include <unistd.h>
 
   1、unsigned int sleep(unsigned int seconds); 秒级
   2、int usleep(useconds_t usec);              微秒级:1/10^-6 
 
   #define _POSIX_C_SOURCE 199309
   #include <a(const struct timespec *req, struct timespec *rem);
       struct timespec {
                  time_t tv_sec;        /* seconds */
                  long   tv_nsec;       /* nanoseconds */
              };
       // The value of the nanoseconds field must be in the range 0 to 999999999.
 
 内核层:
   include <linux/delay.h>
   1、void ndelay(unsigned long nsecs);         纳秒级:1/10^-10
   2、void udelay(unsigned long usecs);         微秒级: 1/10^-6
   3、void mdelay(unsigned long msecs);         毫秒级:1/10^-3
 
 
linux下获取时间的若干函数(z)
 
 
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不同处在于传入的参数是不同的结构。
附加说明
返回一字


相关文档:

实战Linux Bluetooth编程(六) L2CAP编程实例

例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
 如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......

linux 程序内部 查看可执行程序路径

linux shell pwd 显示当前路径
假若有test.cpp
g++ test.cpp -o test
./test
想在test中找到当前执行程序所在的路径
可以再test.cpp中使用readlink函数
具体见如下实例:
#include<iostream>
#include<unistd.h>
#include<dirent.h>
#include<string.h>
#include<string>
using ......

linux命令行下中文文件名乱码的解决方法

linux命令行下中文文件名乱码的解决方法
首先查询支持的编码:
locale -a
如果没有你需要的编码,例如zh_CN.utf8
root运行: #dpkg-reconfigure locales
选择你需要的编码,用空格选中,可多选。tab选择“OK”,回车。
默认编码选择zh_CN.utf8
安装你所需要的编码。
修改/etc/profile,
注释掉
export LC ......

linux netstat 命令常用选项详解

转自:http://hi.baidu.com/zhangdaoxie/blog/item/d9f49f4a991f412b08f7efff.html
Netstat用于显示与IP、TCP、UDP和ICMP协议相关的统计数据,一般用于检验本机各端口的网络连接情况。
如果我们的计算机有时候接受到的数据报会导致出错数据删除或故障,我们不必感到奇怪,TCP/IP可以容许这些类型的错误,并能够自动重发数 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号