one thing that can be done for better testing  this is passing now=time.time as a parameter, and use now() in the function.
this way, you can do dependency injection to unittest precisely this method.