22 lines · plain
1.. title:: clang-tidy - abseil-duration-addition2 3abseil-duration-addition4========================5 6Checks for cases where addition should be performed in the ``absl::Time``7domain. When adding two values, and one is known to be an ``absl::Time``,8we can infer that the other should be interpreted as an ``absl::Duration``9of a similar scale, and make that inference explicit.10 11Examples:12 13.. code-block:: c++14 15 // Original - Addition in the integer domain16 int x;17 absl::Time t;18 int result = absl::ToUnixSeconds(t) + x;19 20 // Suggestion - Addition in the absl::Time domain21 int result = absl::ToUnixSeconds(t + absl::Seconds(x));22