Implement STOPWATCH_TO_TIMEVAL() and fix compile in kernel mode.