title: how validate NTP time synchronization
body: <p>I need create an application that validates NTP time synchronization on each machine. In other words, I need to determine if each machine is my LAN is synched to a common time server (stratum). So, far I came up with two ways. </p>
  
  <p>1) Have the NTP client on each machine generate the statistics file. If I take this approach, which one of the statistics file should I examine to determine if the time on the machine is within some tolerance of the time server? There is a peerstats, clockstats and loopstats. Do any of those files contain information which I can use to determine if the time is synced up?</p>
  
  <p>2) Invoke the ntpq command line argument and pipe its output. Parse the output.</p>
  
  <p>Right now I prefer option 1, but, as I indicated, I am not sure if any of the NTP statistics file contain information which I can use to determine if time is synchronized. </p>
  
  <p>Is there a better approach. </p>
  
  <p>Is there an API which I can use to query the NTP client directly?</p>
  
  <p>Thanks for your help.</p>