Skip to content
Snippets Groups Projects
Commit 8966c8ec authored by Joshua Colp's avatar Joshua Colp Committed by Gerrit Code Review
Browse files

Merge "cdr_mysql: fix UTC support"

parents 9ef0eb64 d3ddf4b0
No related branches found
No related tags found
No related merge requests found
......@@ -245,7 +245,7 @@ db_reconnect:
struct ast_tm tm;
char timestr[128];
ast_localtime(&tv, &tm, ast_str_strlen(cdrzone) ? ast_str_buffer(cdrzone) : NULL);
ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %T", &tm);
ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
value = ast_strdupa(timestr);
cdrname = "calldate";
} else {
......@@ -260,8 +260,7 @@ db_reconnect:
/* Need the type and value to determine if we want the raw value or not */
if (entry->staticvalue) {
value = ast_strdupa(entry->staticvalue);
} else if ((!strcmp(cdrname, "start") ||
!strcmp(cdrname, "answer") ||
} else if ((!strcmp(cdrname, "answer") ||
!strcmp(cdrname, "end") ||
!strcmp(cdrname, "disposition") ||
!strcmp(cdrname, "amaflags")) &&
......@@ -273,6 +272,12 @@ db_reconnect:
strstr(entry->type, "numeric") ||
strstr(entry->type, "fixed"))) {
ast_cdr_format_var(cdr, cdrname, &value, workspace, sizeof(workspace), 1);
} else if (!strcmp(cdrname, "start")) {
struct ast_tm tm;
char timestr[128];
ast_localtime(&cdr->start, &tm, ast_str_strlen(cdrzone) ? ast_str_buffer(cdrzone) : NULL);
ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
value = ast_strdupa(timestr);
} else if (!strcmp(cdrname, "calldate")) {
/* Skip calldate - the value has already been dup'd */
} else {
......
......@@ -18,7 +18,10 @@
;user=asteriskcdruser
;port=3306
;sock=/tmp/mysql.sock
;timezone=UTC ; Previously called usegmtime
; By default CDRs are logged in the system's time zone
;cdrzone=UTC ; log CDRs with UTC
;usegmtime=yes ;log date/time in GMT. Default is "no"
;cdrzone=America/New_York ; or use a specific time zone
;
; If your system's locale differs from mysql database character set,
; cdr_mysql can damage non-latin characters in CDR variables. Use this
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment