From 5c9442d7db6e53cac73166e97cc8a7779e283acc Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 20 May 2026 17:49:02 +0100 Subject: Add a helper function for calculating a percentage. --- modules/sslinfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/sslinfo.cpp') diff --git a/modules/sslinfo.cpp b/modules/sslinfo.cpp index 66cfca3c3..19b51afe6 100644 --- a/modules/sslinfo.cpp +++ b/modules/sslinfo.cpp @@ -37,6 +37,7 @@ #include "numerichelper.h" #include "stringutils.h" #include "timeutils.h" +#include "utility/numeric.h" struct RemoteCertificate final : public TLS::Certificate @@ -616,7 +617,7 @@ public: if (!count) continue; - const auto percent = total ? round((count * 100) / total) : 0; + const auto percent = insp::percentage(count, total); stats.AddGenericRow(FMT::format("{}: {} ({:3.2f}%)", ciphersuite, count, percent)) .AddTags(stats, { { "ciphersuite", ciphersuite }, -- cgit v1.3.1-10-gc9f91