New clock sync control loop.

Change clock sync control to velicity form PI loop. Tuned for office LAN and
WiFi conditions, will probably perform better in clean environments.
Improve packet filtering to prevent clock sync on bad rtt.
Changed diag interface to take rtt times, P, I, D are no longer supported.

Change-Id: Iad2b26eb44cd222ec5f219b49669e2d6baec9d1c
diff --git a/services/common_time/diag_thread.cpp b/services/common_time/diag_thread.cpp
index c8e6053..4cb9551 100644
--- a/services/common_time/diag_thread.cpp
+++ b/services/common_time/diag_thread.cpp
@@ -176,9 +176,7 @@
                                      int64_t observed_common_time,
                                      int64_t nominal_common_time,
                                      int32_t total_correction,
-                                     int32_t P_correction,
-                                     int32_t I_correction,
-                                     int32_t D_correction) {
+                                     int32_t rtt) {
     Mutex::Autolock lock(&discipline_log_lock_);
 
     DisciplineEventRecord evt;
@@ -193,9 +191,7 @@
     evt.observed_common_time = observed_common_time;
     evt.nominal_common_time  = nominal_common_time;
     evt.total_correction     = total_correction;
-    evt.P_correction         = P_correction;
-    evt.I_correction         = I_correction;
-    evt.D_correction         = D_correction;
+    evt.rtt                  = rtt;
 
     discipline_log_.push_back(evt);
     while (discipline_log_.size() > kMaxDisciplineLogSize)
@@ -299,7 +295,7 @@
                 char buf[1024];
                 DisciplineEventRecord& e = *discipline_log_.begin();
                 snprintf(buf, sizeof(buf),
-                         "D,%lld,%lld,%lld,%lld,%lld,%lld,%d,%d,%d,%d\n",
+                         "D,%lld,%lld,%lld,%lld,%lld,%lld,%d,%d\n",
                          e.event_id,
                          e.action_local_time,
                          e.action_common_time,
@@ -307,9 +303,7 @@
                          e.observed_common_time,
                          e.nominal_common_time,
                          e.total_correction,
-                         e.P_correction,
-                         e.I_correction,
-                         e.D_correction);
+                         e.rtt);
                 buf[sizeof(buf) - 1] = 0;
 
                 if (data_fd_ >= 0)