changed timer to timeval