Forráskód Böngészése

timekeeper: improve wording about fields set to 0

y 2 éve
szülő
commit
6c1002a1ba
1 módosított fájl, 4 hozzáadás és 2 törlés
  1. 4 2
      src/util/time.rs

+ 4 - 2
src/util/time.rs

@@ -30,8 +30,10 @@ const MIN_IN_HOUR: u64 = 60;
 const SECS_IN_HOUR: u64 = 3600;
 const SECS_IN_HOUR: u64 = 3600;
 
 
 /// Helper structure providing time related calculations.
 /// Helper structure providing time related calculations.
-/// This struct is optimized for performance and does not check
-/// its arithmetic: division-by-zero is possible for certain values.
+/// This struct is optimized for performance. The developer is responsible
+/// for ensuring `slot_time` and `epoch_length` are greater than 0.
+/// Values of 0 for these fields are incoherent and unsafe in asynchronous
+/// context.
 /// [`TimeKeeperSafe`] should be used if safety is more important than
 /// [`TimeKeeperSafe`] should be used if safety is more important than
 /// performance.
 /// performance.
 #[derive(Clone)]
 #[derive(Clone)]