Possible fix for: Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow
So I saw this story:
Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow
And I came up with something. Let me know if I'm missing something fundamental here.
Maybe I'm missing something fundamental here, but if they didn't want to upgrade the systems to 64-bit, couldn't you do the following:
When the counter reaches max-int, increment a new counter (let's name it bigCounter), and reset the counter to zero.
When checking the difference in time from a timestamp after the counter-reset (meaning the timestamp for bigCounter is different now), check the difference between the timestamp's counter value and maxint, and then:
if (maxint - counter > difference)
return counter + difference
else
increment the returned bigCounter difference
return maxint - difference
Then convert the returned value (counterDiff and bigCounterDiff) in seconds and 248-day increments back to days/hours/minutes (presumably you'd also have a function that returns the difference between the timestamp's bigCounter value too) to check against critical functions.
I realize I'm simplifying here, and it's probably several million dollars to fix, using the above, what could be basically fixed by upgrading to 64-bit architecture, which probably needs to be done anyway.
Thoughts
Leave Possible fix for: Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow to:
Read more #programming posts
Best Posts From Alavan
We have not curated any of alavan's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Alavan
- Game of the Year 2019
- 2018: Game of the year
- 2018 Gaming Recap (The Good, the Sad, and the Ugly)
- XSLT-HTML: A new way to do your server-side UI framework
- Review: Mario Tennis - Aces
- Agile and Scrum are not "Terrible" as this article suggests
- Riding in a Slingshot
- Storm looming over Garden of the Gods
- My attempt at Ace Attorney Pumpkins... OBJECTION!
- Possible fix for: Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow