]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
fixed bug in addNewEntry noticed by Phil (https://www.millennium.berkeley.edu/piperma...
authorkusy <kusy>
Mon, 16 Mar 2009 22:51:18 +0000 (22:51 +0000)
committerkusy <kusy>
Mon, 16 Mar 2009 22:51:18 +0000 (22:51 +0000)
tos/lib/ftsp/TimeSyncP.nc

index 6aed03b86a379ec579b28a6f18dc7274c122a551..864c1c726de8cc148961d9f71f2020d35c15dde0 100644 (file)
@@ -227,8 +227,6 @@ implementation
         uint32_t age, oldestTime = 0;
         int32_t timeError;
 
-        tableEntries = 0;
-
         // clear table if the received entry's been inconsistent for some time
         timeError = msg->localTime;
         call GlobalTime.local2Global((uint32_t*)(&timeError));
@@ -238,10 +236,11 @@ implementation
         {
             if (++numErrors>3)
                 clearTable();
+            return; // don't incorporate a bad reading
         }
-        else
-            numErrors = 0;
 
+        tableEntries = 0; // don't reset table size unless you're recounting
+        numErrors = 0;
 
         for(i = 0; i < MAX_ENTRIES; ++i) {
             age = msg->localTime - table[i].localTime;