I've an application where, for testing, I need to replace the time.time() call with a specific timestamp, I've done that in the past using ruby
(code available here: http://github.com/zemariamm/Back-to-Future/blob/master/back_to_future.rb )
However I do not know how to do this using Python.
Any hints ? Cheers, Ze Maria
You can simply set time.time to point to your new time function, like this:
import time
def my_time():
return 0.0
old_time = time.time
time.time = my_time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With