易截截图软件、单文件、免安装、纯绿色、仅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编程 (七) SDP协议

Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......

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批量该文件名

A 加后缀
1.问题:同以目录下有海量以日期命名的文件,其中有的有后缀,有的以点结尾,如20020101.,20020102.,……,20020101.td,20020102.td……
要求: 把所有以点结尾的加上后缀.ts
我的方法:
#!/bin/bash
for files in `ls *.`
do
mv $files `echo “$filests” `
done ......

linux netstat 命令常用选项详解

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

虚拟机下linux挂载U盘

需要让你的虚拟机Guest OS(Linux)能自动识别U盘。
方法如下:
保持焦点在Linux上,插入U盘,这时宿主操作系统Windows会弹出“找到新设备的提示”,然后一步一步
的点下一步,结束以后,就可以在linux使用fdisk -l /dev/sdb命令查看到/dev/sdb1。
在虚拟机识别出USB之后,用
fdisk -l /dev/sdb

fdisk -l ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号