metrics: Use >= for accumulation period check

With a > comparison, an extra update_period would have to be waited for
to get an accumulation cycle to fire. This was only a real problem in
unit tests with a fake timer.

BUG=b:218422987
Fixed: b:218422987
TEST=env FEATURES=test emerge-amd64-generic metrics hpsd

Change-Id: Ib4b95d8cad6448989c275b72a282f5aabba6dc37
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/3620635
Commit-Queue: Evan Benn <evanbenn@chromium.org>
Reviewed-by: Ian Barkley-Yeung <iby@chromium.org>
Tested-by: Evan Benn <evanbenn@chromium.org>
diff --git a/hps/hps_metrics_test.cc b/hps/hps_metrics_test.cc
index c76e1fd..078f3ca 100644
--- a/hps/hps_metrics_test.cc
+++ b/hps/hps_metrics_test.cc
@@ -115,8 +115,7 @@
 
 // Without a SendImageValidity call, no metric is sent
 TEST_F(HpsMetricsTest, ValidityNopTest) {
-  // An extra cycle is required to fire the Report callback b/218422987
-  task_environment_.FastForwardBy(kAccumulatePeriod + kUpdatePeriod);
+  task_environment_.FastForwardBy(kAccumulatePeriod);
 }
 
 // Test with 50% valid images
@@ -128,8 +127,7 @@
   EXPECT_CALL(*GetMetricsLibraryMock(),
               SendToUMA(kHpsImageInvalidity, 500, _, _, _))
       .Times(1);
-  // An extra cycle is required to fire the Report callback b/218422987
-  task_environment_.FastForwardBy(kAccumulatePeriod + kUpdatePeriod);
+  task_environment_.FastForwardBy(kAccumulatePeriod);
 }
 
 // Test with 1 invalid image
@@ -142,8 +140,7 @@
   EXPECT_CALL(*GetMetricsLibraryMock(),
               SendToUMA(kHpsImageInvalidity, 1, _, _, _))
       .Times(1);
-  // An extra cycle is required to fire the Report callback b/218422987
-  task_environment_.FastForwardBy(kAccumulatePeriod + kUpdatePeriod);
+  task_environment_.FastForwardBy(kAccumulatePeriod);
 }
 
 }  // namespace hps
diff --git a/metrics/cumulative_metrics.cc b/metrics/cumulative_metrics.cc
index 26f7a69..52b6ad5 100644
--- a/metrics/cumulative_metrics.cc
+++ b/metrics/cumulative_metrics.cc
@@ -90,7 +90,7 @@
 bool CumulativeMetrics::ProcessCycleEnd() {
   base::TimeDelta wall_time = Time::Now() - Time::UnixEpoch();
   base::TimeDelta cycle_start = base::Microseconds(cycle_start_->Get());
-  if (wall_time - cycle_start > accumulation_period_) {
+  if (wall_time - cycle_start >= accumulation_period_) {
     cycle_start_->Set(wall_time.InMicroseconds());
     return true;
   }