mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::util: Add pretty() convenience to timer.
This commit is contained in:
parent
2e586fe529
commit
0cdbe472d1
2 changed files with 17 additions and 0 deletions
|
@ -27,6 +27,8 @@ struct ircd::util::timer
|
|||
bool stopped() const;
|
||||
template<class duration = std::chrono::seconds> duration get() const;
|
||||
template<class duration = std::chrono::seconds> duration at() const;
|
||||
string_view pretty(const mutable_buffer &out, const int &fmt = 0) const;
|
||||
std::string pretty(const int &fmt = 0) const;
|
||||
void cont();
|
||||
void stop();
|
||||
|
||||
|
|
15
ircd/util.cc
15
ircd/util.cc
|
@ -524,6 +524,21 @@ ircd::util::timer::cont()
|
|||
start = clock::now();
|
||||
}
|
||||
|
||||
std::string
|
||||
ircd::util::timer::pretty(const int &fmt)
|
||||
const
|
||||
{
|
||||
return util::pretty(at(), fmt);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::util::timer::pretty(const mutable_buffer &out,
|
||||
const int &fmt)
|
||||
const
|
||||
{
|
||||
return util::pretty(out, at(), fmt);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::util::timer::stopped()
|
||||
const
|
||||
|
|
Loading…
Reference in a new issue