在 看协议的过程中经常会有同步 时间计算获得时间延迟,所以会用到timeval
/*
* Structure used in select() call, taken from the BSD file sys/time.h.
*/
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
tv_sec 代表多少秒
tv_usec 代表多少微秒 1000000 微秒 = 1秒
上面taken from the BSD file sys/time.h 直接用函数 gettimeofday 就可以获得时间
本文详细介绍了在协议分析中常遇到的时间计算方法,特别是使用timeval结构进行时间延迟计算的过程。timeval结构由tv_sec(秒)和tv_usec(微秒)组成,通过gettimeofday函数可以获取当前时间。
313

被折叠的 条评论
为什么被折叠?



