freezegun icon indicating copy to clipboard operation
freezegun copied to clipboard

Correct ticking behavior with `time.time_ns()`

Open jeffdn opened this issue 1 year ago • 0 comments

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.

jeffdn avatar Oct 20 '22 21:10 jeffdn