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
Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!
Reply !stop to disable the comment. Thanks!