title: How to measure very long elapsed time robustly in C
body: <p>I want to measure the uptime of my application that may run for days and months. And I will report this uptime when the user requests.</p>
  
  <p>I don't want to get system time by <code>time()</code> because system time can be altered by the user. I want to reliably measure how much time has passed since my application was started.</p>
  
  <p>I am currently using <code>clock_gettime(CLOCK_MONOTONIC, …)</code> on Linux and <code>QueryPerformanceCounter(…)</code> on Windows. Once during the application start, and again when the application needs to report the uptime. I believe these functions make use of the cpu's inner timers, and they may divert over long periods.</p>
  
  <ol>
  <li>How much would these timers divert over, say, a month of time?</li>
  <li>Is there a better and more reliable way to measure elapsed wall-clock-time, assuming there is no internet connectivity to an NTP server?</li>
  </ol>