The manual says tv_sec is of type long, this is wrong, it is of type time_t.
commit 87a629c5d7aa559e5c144196bce123469b17af4c Author: Rüdiger Sonderfeld <ruediger@c-plusplus.net> Date: Thu Feb 12 14:51:31 2015 -0500 Document tv_sec is of type time_t: The tv_sec is of type time_t in both struct timeval and struct timespec. This matches the implementation and also the relevant standard (checked C11 for timespec and opengroup for timeval).