Include startup and reload date in the CoreStatus manager message.
authorSean Bright <sean@malleable.com>
Tue, 26 May 2009 20:20:08 +0000 (20:20 +0000)
committerSean Bright <sean@malleable.com>
Tue, 26 May 2009 20:20:08 +0000 (20:20 +0000)
The CoreStartupTime and CoreReloadTime name/value pairs in the CoreStatus
response message only included the time and not the date.  This patch,
inspired by the reporter's patch, adds 2 new fields - CoreStartupDate and
CoreReloadDate - which contain the date portion of these values.

(closes issue #15000)
Reported by: sum

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196907 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index ba1d2f5..25e976a 100644 (file)
@@ -3354,8 +3354,8 @@ static int action_corestatus(struct mansession *s, const struct message *m)
 {
        const char *actionid = astman_get_header(m, "ActionID");
        char idText[150];
-       char startuptime[150];
-       char reloadtime[150];
+       char startuptime[150], startupdate[150];
+       char reloadtime[150], reloaddate[150];
        struct ast_tm tm;
 
        if (!ast_strlen_zero(actionid)) {
@@ -3366,17 +3366,23 @@ static int action_corestatus(struct mansession *s, const struct message *m)
 
        ast_localtime(&ast_startuptime, &tm, NULL);
        ast_strftime(startuptime, sizeof(startuptime), "%H:%M:%S", &tm);
+       ast_strftime(startupdate, sizeof(startupdate), "%Y-%m-%d", &tm);
        ast_localtime(&ast_lastreloadtime, &tm, NULL);
        ast_strftime(reloadtime, sizeof(reloadtime), "%H:%M:%S", &tm);
+       ast_strftime(reloaddate, sizeof(reloaddate), "%Y-%m-%d", &tm);
 
        astman_append(s, "Response: Success\r\n"
                        "%s"
+                       "CoreStartupDate: %s\r\n"
                        "CoreStartupTime: %s\r\n"
+                       "CoreReloadDate: %s\r\n"
                        "CoreReloadTime: %s\r\n"
                        "CoreCurrentCalls: %d\r\n"
                        "\r\n",
                        idText,
+                       startupdate,
                        startuptime,
+                       reloaddate,
                        reloadtime,
                        ast_active_channels()
                        );