Improve timing mechanisms in tests that deal in delays.

Hopefully this will help the build be more reliable.