Add current_time() to moodlelib - which either just returns time() or if a global is set returns the time relative to a manually set time.
Add a function to the data generator to allow the current time to be set.
Replace all calls to time() with current_time().
- current_time() is not very descriptive
- changing all calls to time() will create a large patch (1232 instances outside of tests)