#Centipede When stop_at is less than one second ahead, trigger the alarm instead of calling alarm(0). This is better because alarm(0) doesn't actually set or trigger an alarm. PiperOrigin-RevId: 561435835
diff --git a/centipede/centipede_interface.cc b/centipede/centipede_interface.cc index 9ea4a10..ab4ad63 100644 --- a/centipede/centipede_interface.cc +++ b/centipede/centipede_interface.cc
@@ -74,7 +74,7 @@ if (stop_at != absl::InfiniteFuture()) { const absl::Duration stop_in = stop_at - absl::Now(); - if (stop_in > absl::ZeroDuration()) { + if (stop_in >= absl::Seconds(1)) { LOG(INFO) << "Setting alarm for --stop_at time " << stop_at << " (in " << stop_in << ")"; PCHECK(alarm(absl::ToInt64Seconds(stop_in)) == 0) << "Alarm already set";