mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
util: Use more compact fmt for abbrev time.
This commit is contained in:
parent
8f6c17aeb1
commit
3b2188280a
1 changed files with 8 additions and 3 deletions
11
ircd/util.cc
11
ircd/util.cc
|
@ -78,6 +78,13 @@ ircd::util::pretty_nanoseconds(const mutable_buffer &out,
|
|||
{ "days", "d" },
|
||||
}};
|
||||
|
||||
const string_view &fmtstr
|
||||
{
|
||||
fmt == 1?
|
||||
"%.2lf%s"_sv:
|
||||
"%.2lf %s"_sv
|
||||
};
|
||||
|
||||
auto pos(0);
|
||||
long double val(ns);
|
||||
|
||||
|
@ -132,9 +139,7 @@ ircd::util::pretty_nanoseconds(const mutable_buffer &out,
|
|||
done:
|
||||
return fmt::sprintf
|
||||
{
|
||||
out, "%.2lf %s",
|
||||
val,
|
||||
unit.at(pos).at(fmt)
|
||||
out, fmtstr, val, unit.at(pos).at(fmt)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue