mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-03 20:38:59 +00:00
Eliminate localtime calls, various cleanups
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -107,7 +107,7 @@ static int append_int(char *buf, int s, int len)
|
||||
static int append_date(char *buf, struct timeval tv, int len)
|
||||
{
|
||||
char tmp[80];
|
||||
struct tm *tm;
|
||||
struct tm tm;
|
||||
time_t t;
|
||||
t = tv.tv_sec;
|
||||
if (strlen(buf) > len - 3)
|
||||
@@ -116,8 +116,8 @@ static int append_date(char *buf, struct timeval tv, int len)
|
||||
strncat(buf, ",", len);
|
||||
return 0;
|
||||
}
|
||||
tm = localtime(&t);
|
||||
strftime(tmp, sizeof(tmp), DATE_FORMAT, tm);
|
||||
localtime_r(&t,&tm);
|
||||
strftime(tmp, sizeof(tmp), DATE_FORMAT, &tm);
|
||||
return append_string(buf, tmp, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ static MYSQL *mysql;
|
||||
|
||||
static int mysql_log(struct ast_cdr *cdr)
|
||||
{
|
||||
struct tm *tm;
|
||||
struct tm tm;
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
char *sqlcmd, timestr[128];
|
||||
@@ -51,8 +51,8 @@ static int mysql_log(struct ast_cdr *cdr)
|
||||
|
||||
gettimeofday(&tv,&tz);
|
||||
t = tv.tv_sec;
|
||||
tm = localtime(&t);
|
||||
strftime(timestr,128,DATE_FORMAT,tm);
|
||||
localtime_r(&t,&tm);
|
||||
strftime(timestr,128,DATE_FORMAT,&tm);
|
||||
|
||||
|
||||
ast_log(LOG_DEBUG,"cdr_mysql: inserting a CDR record.\n");
|
||||
|
||||
Reference in New Issue
Block a user