[Asterisk-Dev] Time stamps

Steve Brown sbrown at cortland.com
Sat Apr 5 18:59:01 MST 2003


Mark,

Would you consider this patch too?

Steve

RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 asterisk.c
--- asterisk.c  16 Mar 2003 22:37:29 -0000      1.1.1.5
+++ asterisk.c  6 Apr 2003 02:04:02 -0000
@@ -687,11 +687,15 @@
 static char *cli_prompt(EditLine *el)
 {
        char prompt[80];
+       time_t current;
+
+       current = time(NULL);
+       strftime(prompt, sizeof(prompt), "[%H:%M:%S]", localtime(&current));

        if (remotehostname)
-               snprintf(prompt, sizeof(prompt), ASTERISK_PROMPT2, 
remotehostname);
+               snprintf(prompt + strlen(prompt), sizeof(prompt), 
ASTERISK_PROMPT2, remotehostname);
        else
-               snprintf(prompt, sizeof(prompt), ASTERISK_PROMPT);
+               snprintf(prompt + strlen(prompt), sizeof(prompt), 
ASTERISK_PROMPT);

        return strdup(prompt);
 }
Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 logger.c
--- logger.c    16 Mar 2003 22:37:29 -0000      1.1.1.2
+++ logger.c    6 Apr 2003 02:04:03 -0000
@@ -296,6 +296,10 @@
        struct msglist *m;
        struct verb *v;
        va_list ap;
+       time_t current;
+       current = time(NULL);
+       strftime(stuff, sizeof(stuff), "[%H:%M:%S]", localtime(&current));
+       pos = strlen(stuff);
        va_start(ap, fmt);
        ast_pthread_mutex_lock(&msglist_lock);
        vsnprintf(stuff + pos, sizeof(stuff) - pos, fmt, ap);





More information about the asterisk-dev mailing list