mirror of
https://github.com/matrix-construct/construct
synced 2025-03-14 05:20:17 +01:00
modules/console: Add uptime cmd.
This commit is contained in:
parent
46cb5aee41
commit
c5e066d078
1 changed files with 35 additions and 0 deletions
|
@ -527,6 +527,41 @@ console_cmd__info(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__uptime(opt &out, const string_view &line)
|
||||
{
|
||||
const seconds uptime
|
||||
{
|
||||
ircd::uptime()
|
||||
};
|
||||
|
||||
const hours uptime_h
|
||||
{
|
||||
uptime.count() / (60L * 60L)
|
||||
};
|
||||
|
||||
const minutes uptime_m
|
||||
{
|
||||
(uptime.count() / 60L) % 60L
|
||||
};
|
||||
|
||||
const minutes uptime_s
|
||||
{
|
||||
uptime.count() % 60L
|
||||
};
|
||||
|
||||
out << "Running for ";
|
||||
|
||||
if(uptime_h.count())
|
||||
out << uptime_h.count() << " hours ";
|
||||
|
||||
if(uptime_m.count())
|
||||
out << uptime_m.count() << " minutes ";
|
||||
|
||||
out << uptime_s.count() << " seconds." << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// mem
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue