Add timing code from ZXDunny's idea.