From dafa73bade9211f06f771db69783661b75cc7922 Mon Sep 17 00:00:00 2001 From: Steve Murphy <murf@digium.com> Date: Mon, 10 Mar 2008 14:55:21 +0000 Subject: [PATCH] way back in July, in r.75706, a fix was made ot the strftime usages, which was good, but in this case, the check for a nil time was accidentally removed, and now it is restored, to keep timevals like '1969-12-31 17:00:00' from showing up in the cdrs. No idea what databases will do with this. No bugs filed as yet, but it felt like a bug. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@107019 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/cdr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main/cdr.c b/main/cdr.c index 183252438a..5b68e8fed7 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -200,11 +200,13 @@ static void cdr_get_tv(struct timeval tv, const char *fmt, char *buf, int bufsiz { if (fmt == NULL) { /* raw mode */ snprintf(buf, bufsize, "%ld.%06ld", (long)tv.tv_sec, (long)tv.tv_usec); - } else { - struct ast_tm tm; - - ast_localtime(&tv, &tm, NULL); - ast_strftime(buf, bufsize, fmt, &tm); + } else { + if (tv.tv_sec) { + struct ast_tm tm; + + ast_localtime(&tv, &tm, NULL); + ast_strftime(buf, bufsize, fmt, &tm); + } } } -- GitLab