Is there not some required library we should tell gcc to use while linking so that select can manage time?
The headers you need for select are outlined in the manual. Try “man select” and you will find everything you need. Note that when using a timeout in select, Linux will change the time structure to reflect the remaining amount of time. For example, I tell select to timeout after 60 seconds, but select returns after 40 seconds. The time structure I handed it will now read 20 seconds. This behavior is system-dependant and your code should not rely on it. To ensure portability, you should check the current time using gettimeofday() and then, as the manual page suggests, reset the time structure before each call.