Fix conversion of timeout to struct timeval.