0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-12 23:18:55 +02:00

modules/console: Add uptime cmd.

This commit is contained in:
Jason Volk 2018-09-16 18:32:46 -07:00
parent 46cb5aee41
commit c5e066d078

View file

@ -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
//