Why do you allocate timeval in heap?
If there is no problem, please use "struct timeval timeval".