title: clock() Returns Negative Value?
body: <p>I have created a server program, and a certain error has occurred twice where the function 'clock()' has returned a negative value (and crashed the server). Both times it occurred when the program had been running for more than 100 hours, on a Windows 32-bit VPS.</p>
  
  <p>Here's the setup I have in main.cpp (cut where appropriate):</p>
  
  <pre><code>while (1) {
      Sleep(STEP);
  
              //execute main code like connection handling, AI, etc.
  
      //check for clock error
      if (clock() &lt; 0) {
          //error saved here
  
                  //close server
          return 0;
      }
  }
  </code></pre>
  
  <p>That's it, pretty simple. clock() is used throughout the rest of the program extensively, so when it glitches up like this it causes a lot of problems.</p>
  
  <p>I am wondering, why does it return a negative value, and how can I fix it?</p>
  
  <p>Thanks.</p>