Fix interval calculation bug and D-Bus init

The new timing parameters were not settable from the D-Bus code path,
only from the old static JSON code path. Also, the divison would not
occur, causing the variable to remain at 1000 by default, not 10,
causing the thermal intervals to run 100 times slower than intended!

I fixed the algorithm used to calculate when the thermal intervals
should be inserted amongst the fan intervals. Now, the division is
not necessary, and any value should work, so long as the thermal
interval is greater than or equal to the fan interval.

I also fixed a subtle bug regarding the timer scheduling. It was
reinitializing the timer expiration time from "now" each interval,
instead of cleanly incrementing from the original expiration. This
caused the timer to run slower than intended, as the execution time
of each interval would not be subtracted out from the remaining time
that needs to be waited for, as it should have been.

Tested: Default values, for timing parameters, now work as intended

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: I759387b97af3ce93a76459faf5e9e7be3474016e
diff --git a/test/pid_json_unittest.cpp b/test/pid_json_unittest.cpp
index eb9ca58..c58f3f4 100644
--- a/test/pid_json_unittest.cpp
+++ b/test/pid_json_unittest.cpp
@@ -254,9 +254,7 @@
 
     EXPECT_EQ(pidConfig[1]["fan1-5"].type, "fan");
     EXPECT_EQ(zoneConfig[1].cycleTime.cycleIntervalTimeMS, 1000);
-    // updateThermalsTimeMS would be updated as updateThermalsTimeMS /
-    // cycleIntervalTimeMS
-    EXPECT_EQ(zoneConfig[1].cycleTime.updateThermalsTimeMS, 1);
+    EXPECT_EQ(zoneConfig[1].cycleTime.updateThermalsTimeMS, 1000);
     EXPECT_DOUBLE_EQ(zoneConfig[1].minThermalOutput, 3000.0);
 }