比如,
tv.tv_sec = 10;
tv.tv_usec = 0;
那么在第7秒的时间发生了一个读事件,我能否得到已经过去的时间或剩余的时间如3或7呢
On Linux, the function select modifies timeout to reflect the amount of time not slept; most other implementations do not do this. This causes problems both when Linux code which reads timeout is ported to other operating systems, and when code is ported to Linux that reuses a struct timeval for multiple selects in a loop without reinitializing it. Consider timeout to be undefined after select returns.
建议不要使用timeout返回值。可以在select之前和之后取系统时间来计算。