diff options
| author | 2026-05-20 17:49:02 +0100 | |
|---|---|---|
| committer | 2026-05-20 17:49:02 +0100 | |
| commit | 5c9442d7db6e53cac73166e97cc8a7779e283acc (patch) | |
| tree | 86a6d53e9abd32004a4654a944c6bba0f491b331 /modules/tline.cpp | |
| parent | Merge branch 'insp4' into master. (diff) | |
Add a helper function for calculating a percentage.
Diffstat (limited to 'modules/tline.cpp')
| -rw-r--r-- | modules/tline.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/tline.cpp b/modules/tline.cpp index d9cbb9879..33d466e42 100644 --- a/modules/tline.cpp +++ b/modules/tline.cpp @@ -23,6 +23,7 @@ #include "inspircd.h" +#include "utility/numeric.h" class CommandTline final : public Command @@ -61,7 +62,7 @@ public: unsigned long n_counted = ServerInstance->Users.GetUsers().size(); if (n_matched) { - float p = (n_matched / (float)n_counted) * 100; + const auto p = insp::percentage(n_matched, n_counted); user->WriteNotice("*** TLINE: Counted {} user(s). Matched '{}' against {} user(s) ({:0.2}% of the userbase). {} by hostname and {} by IP address.", n_counted, parameters[0], n_matched, p, n_match_host, n_match_ip); } |
