freezegun
freezegun copied to clipboard
Correct ticking behavior with `time.time_ns()`
Previously, when freeze_time(..., tick=True)
was used in conjunction with functions that called out to time.time_ns()
, identical values were being returned. This was caused by the existing version of fake_time_ns
rounding off the last nine digits of the returned integer value -- ensuring that each tick would be erased.
This commit only casts to int
after the value has been shifted by 1e9
, rather than before and after.