24 lines · plain
1.. title:: clang-tidy - abseil-time-comparison2 3abseil-time-comparison4======================5 6Prefer comparisons in the ``absl::Time`` domain instead of the integer domain.7 8N.B.: In cases where an ``absl::Time`` is being converted to an integer,9alignment may occur. If the comparison depends on this alignment, doing the10comparison in the ``absl::Time`` domain may yield a different result. In11practice this is very rare, and still indicates a bug which should be fixed.12 13Examples:14 15.. code-block:: c++16 17 // Original - Comparison in the integer domain18 int x;19 absl::Time t;20 if (x < absl::ToUnixSeconds(t)) ...21 22 // Suggested - Compare in the absl::Time domain instead23 if (absl::FromUnixSeconds(x) < t) ...24