time-utils: fix clang-tidy warning
The code already does size checking to ensure that buffer overruns
are not done, so switch to using operator[] rather than pointer
arithmetic.
```
../redfish-core/include/utils/time_utils.hpp:71:19: error: unsafe pointer arithmetic [-Werror,-Wunsafe-buffer-usage]
end = fmt.data() + pos;
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iaabe82d7c1621dc27ad10288732609dfd0516d17
diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
index cb018ef..e2a6051 100644
--- a/redfish-core/include/utils/time_utils.hpp
+++ b/redfish-core/include/utils/time_utils.hpp
@@ -64,11 +64,11 @@
std::chrono::milliseconds::rep ticks = 0;
if constexpr (std::is_same_v<FromTime, std::chrono::milliseconds>)
{
- end = fmt.data() + std::min<size_t>(pos, 3U);
+ end = &fmt[std::min<size_t>(pos, 3U)];
}
else
{
- end = fmt.data() + pos;
+ end = &fmt[pos];
}
auto [ptr, ec] = std::from_chars(fmt.data(), end, ticks);