Fix context event timeout

The timeout was being passed in as nanaseconds instead of microseconds that a timeval requires, and the creation of the timeval struct wasn't cross platform.