You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's difficult to deal with precision higher than milliseconds.
I'm attempting to write tests dealing with nanosecond precision and they're failing all over the place. Couple this with the face that DateFormatter won't format anything smaller than milliseconds and maybe Time should just cap things off there.
The text was updated successfully, but these errors were encountered:
Forgive me if I'm telling you stuff you already know, but...
Macs coalesce timers into 15ms windows to save power (and I assume iOS devices are even more aggressive). That makes writing tests for code dealing with smaller units of duration really hard. If you're running into trouble, you may want to try disabling coalescing: https://timoliver.blog/2014/01/25/disabling-timer-coalescing-in-os-x-mavericks/.
I've been bitten by this many times, and I forget this little nugget each time and waste hours debugging.
Maybe a way to approach this could be having the system clocks pull their initial date via Date(), but then count and track intervals since then via a ContinuousClock, which would has higher precision than the milliseconds-by-default values coming out of Date.
It's difficult to deal with precision higher than milliseconds.
I'm attempting to write tests dealing with nanosecond precision and they're failing all over the place. Couple this with the face that
DateFormatter
won't format anything smaller than milliseconds and maybeTime
should just cap things off there.The text was updated successfully, but these errors were encountered: