Add 'Uptime' command to *znc

ToDo: Use some readable format for displaying the uptime. Seconds just
don't make it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1095 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-06-17 07:52:56 +00:00
parent acc39c9351
commit 78f8cce2c6
3 changed files with 14 additions and 0 deletions

View File

@@ -1554,6 +1554,11 @@ void CClient::UserCommand(const CString& sLine) {
PutStatus(sTmp);
}
}
} else if (m_pUser->IsAdmin() && sCommand.CaseCmp("UPTIME") == 0) {
time_t started = CZNC::Get().TimeStarted();
time_t now = time(NULL);
PutStatus("Running for " + CString(now - started) + " seconds");
} else {
PutStatus("Unknown command [" + sCommand + "] try 'Help'");
}
@@ -1752,6 +1757,11 @@ void CClient::HelpUser() {
Table.SetCell("Arguments", "");
Table.SetCell("Description", "Show basic traffic stats for all znc users");
Table.AddRow();
Table.SetCell("Command", "Uptime");
Table.SetCell("Arguments", "");
Table.SetCell("Description", "Show how long ZNC is already running");
Table.AddRow();
Table.SetCell("Command", "SetMOTD");
Table.SetCell("Arguments", "<Message>");