A process might run for a long time, and it’s important for code to ensure that the long-running process doesn’t crash unexpectedly. Alexander found this block of code, which carefully protects against overflows:

if (_totalSeconds < ulong.MaxValue)
{  
   _totalSeconds += 1;
}  
else
{  
   _totalSeconds = 0;  
}

Even if the process runs for 18,446,744,073,709,551,615 seconds, we can rest assured that it will not crash. In the year 35,096,545,043,317AD , when the the Earth has been long forgotten, and the heat death of the universe has denied the computer enough power to run, at least it’s not the programmer’s fault that the process failed.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!