to timeval. Also, don't truncate the seconds part to int for y2038. I've had this patch sitting around since 2010 and I completely forget what motivated it.