When running some long integration test sequences, we stub Time to have controllable relative timing of certain events,
However, in the some test suite logs, we’d like to print actual elapsed time for certain parts of the test. (As one example, we repeat certain sequences a lot of times, and want to measure any degradation in test performance as the test dataset grows larger.)
Is there any way to access the true system time during tests once Time is stubbed?
You could try calling
unstubas described here.If you only need to set a specific epoch, you might try timecop and its ‘travel’ option’