Reorganized delay and timeout to correct time base and test it in
emulator.