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
Since CircuitPython floats have very small precision, the "total_seconds"
method was not very useful for large timedeltas.
Instead of always returning a float, use pure-integer arithmetic (and
return an int) if either:
* the length of time is big (1<<21 is 2097152 seconds or about 24 days)
* the number of microseconds is zero
Otherwise, for small values with nonzero microseconds, use floating-point
math.
The cut-off point was chosen because in CircuitPython float arithmetic,
2097151.0+0.5 is different from 2097151.0, but 2097152.0+0.5 and
2097152.0 are *the same float*.
0 commit comments