I was reading a tutorial and it had this inside it. Basically I have to have this class to prevent the function GetTickCount() from returning to 0 after a number of days after there is no memory left. But my question is, why? It comes from this tutorial: http://noobtuts.com/programming/c-plus-plus/interval
There is a link in that tutorial that redirects me to the site that this code originally came from but it explains a variety of things that a beginner like me wouldn't really understand; I just want to know why I need this class.
I'm not sure exactly what you're asking. Did you want a real example why you might need that timer to give a proper value?
Basically it's saying if you let your counter run for ~49 days, the value returned will not be correct, as the counter just wraps right back around to zero.
Let's say for example, I'm running a nuclear power plant. I want to know how often a certain safety feature is being used. It's expected to be used a few times a month, but if it's used in rapid succession, to avert possible problems, the control rods are dropped in and therefore, the power plant is shutdown. This costs a lot of money and time.
Okay so now let's imagine the safety feature is not used for 49.7 days and overflows back to zero and then is suddenly used. Our counter will say it was last used only minutes ago! The power plant will have to be shutdown because a safety feature was called twice quickly. Something must be wrong! But of course, the problem is with the counter resetting to zero.
Of course, far more disastrous scenarios than this can occur!
Although, I personally don't understand why 64 bit ints are not used for this kind of stuff. oh well.