Linux下时间延迟以及延缓操作
|
1、在内核中计时的头函数是#include 3、#include volatile unsigned long jiffies 用这个变量来度量时间的变化。 4、int time_after(unsigned long a, unsigned long b) int time_before(unsigned long a, unsigned long b) 这些布尔表达式以安全的方式比较jiffies的数值,无需考虑计时器溢出的问题。 5、jiffies表示的时间和其他表示方法之间的数值转换: unsigned long timespec_to_jiffies(struct timespec *value); (每次总是记不住,这次写到blog上以备后患)其中timespec和timeval是linux系统中时钟时间的结构: struct timeval { struct timespec 使用这个结构的头文件在#include 中,一般常用到的函数是: int gettimeofday(struct timeval *tv, struct timezone *tz); 源代码网供稿. |
