Add time to case generator for OTA restore

This commit is to fix http://manage.dimagi.com/default.asp?62960.
Includes lots of fixing tests because of it as well.