Using CLOCK_MONOTONIC instead of CLOCK_REALTIME now.
Fixed timeout comparison for systems missing GNU posix extensions.