Backport of time machine feature in the unit test helper.