| ▲ | tom_ 3 days ago | ||||||||||||||||||||||
A couple of the comments to the article suggest using 64-bit numbers, which is exactly the right solution. 2^64 nanoseconds=584.55 years - overflow is implausible for any realistic use case. Even pathological cases will struggle to induce wraparound at a human timescale. (People will probably moan at the idea of restarting the process periodically rather than fixing the issue properly, but when the period would be something like 50 years I don't think it's actually a problem.) | |||||||||||||||||||||||
| ▲ | thaumasiotes 3 days ago | parent | next [-] | ||||||||||||||||||||||
> but when the period would be something like 50 years I don't think it's actually a problem I think you have that backwards. If something needs to be done every week, it will get done every week. That's not a problem. If something needs to be done every fifty years, you'll be lucky if it happens once. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | ale42 3 days ago | parent | prev [-] | ||||||||||||||||||||||
> using 64-bit numbers, which is exactly the right solution On a 64-bit platform, sure. When you're working on ring buffers with an 8-bit microcontroller, using 64-bit numbers would be such an overhead that nobody would even think of it. | |||||||||||||||||||||||