mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
use ast_localtime() in every place localtime_r() was being used
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@69392 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -199,7 +199,7 @@ static int append_date(char *buf, struct timeval tv, size_t bufsize)
|
||||
if (usegmtime) {
|
||||
gmtime_r(&t,&tm);
|
||||
} else {
|
||||
localtime_r(&t,&tm);
|
||||
ast_localtime(&t, &tm, NULL);
|
||||
}
|
||||
strftime(tmp, sizeof(tmp), DATE_FORMAT, &tm);
|
||||
return append_string(buf, tmp, bufsize);
|
||||
|
@@ -95,17 +95,17 @@ static int manager_log(struct ast_cdr *cdr)
|
||||
return 0;
|
||||
|
||||
t = cdr->start.tv_sec;
|
||||
localtime_r(&t, &timeresult);
|
||||
ast_localtime(&t, &timeresult, NULL);
|
||||
strftime(strStartTime, sizeof(strStartTime), DATE_FORMAT, &timeresult);
|
||||
|
||||
if (cdr->answer.tv_sec) {
|
||||
t = cdr->answer.tv_sec;
|
||||
localtime_r(&t, &timeresult);
|
||||
ast_localtime(&t, &timeresult, NULL);
|
||||
strftime(strAnswerTime, sizeof(strAnswerTime), DATE_FORMAT, &timeresult);
|
||||
}
|
||||
|
||||
t = cdr->end.tv_sec;
|
||||
localtime_r(&t, &timeresult);
|
||||
ast_localtime(&t, &timeresult, NULL);
|
||||
strftime(strEndTime, sizeof(strEndTime), DATE_FORMAT, &timeresult);
|
||||
|
||||
manager_event(EVENT_FLAG_CALL, "Cdr",
|
||||
|
@@ -99,7 +99,7 @@ static int odbc_log(struct ast_cdr *cdr)
|
||||
if (usegmtime)
|
||||
gmtime_r(&cdr->start.tv_sec,&tm);
|
||||
else
|
||||
localtime_r(&cdr->start.tv_sec,&tm);
|
||||
ast_localtime(&cdr->start.tv_sec, &tm, NULL);
|
||||
|
||||
ast_mutex_lock(&odbc_lock);
|
||||
strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
|
||||
|
@@ -77,7 +77,7 @@ static int pgsql_log(struct ast_cdr *cdr)
|
||||
|
||||
ast_mutex_lock(&pgsql_lock);
|
||||
|
||||
localtime_r(&cdr->start.tv_sec,&tm);
|
||||
ast_localtime(&cdr->start.tv_sec, &tm, NULL);
|
||||
strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
|
||||
|
||||
if ((!connected) && pghostname && pgdbuser && pgpassword && pgdbname) {
|
||||
|
@@ -145,7 +145,7 @@ static int build_radius_record(VALUE_PAIR **send, struct ast_cdr *cdr)
|
||||
if (ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME))
|
||||
gmtime_r(&(cdr->start.tv_sec), &tm);
|
||||
else
|
||||
localtime_r(&(cdr->start.tv_sec), &tm);
|
||||
ast_localtime(&(cdr->start.tv_sec), &tm, NULL);
|
||||
strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
|
||||
if (!rc_avpair_add(rh, send, PW_AST_START_TIME, timestr, strlen(timestr), VENDOR_CODE))
|
||||
return -1;
|
||||
@@ -154,7 +154,7 @@ static int build_radius_record(VALUE_PAIR **send, struct ast_cdr *cdr)
|
||||
if (ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME))
|
||||
gmtime_r(&(cdr->answer.tv_sec), &tm);
|
||||
else
|
||||
localtime_r(&(cdr->answer.tv_sec), &tm);
|
||||
ast_localtime(&(cdr->answer.tv_sec), &tm, NULL);
|
||||
strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
|
||||
if (!rc_avpair_add(rh, send, PW_AST_ANSWER_TIME, timestr, strlen(timestr), VENDOR_CODE))
|
||||
return -1;
|
||||
@@ -163,7 +163,7 @@ static int build_radius_record(VALUE_PAIR **send, struct ast_cdr *cdr)
|
||||
if (ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME))
|
||||
gmtime_r(&(cdr->end.tv_sec), &tm);
|
||||
else
|
||||
localtime_r(&(cdr->end.tv_sec), &tm);
|
||||
ast_localtime(&(cdr->end.tv_sec), &tm, NULL);
|
||||
strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
|
||||
if (!rc_avpair_add(rh, send, PW_AST_END_TIME, timestr, strlen(timestr), VENDOR_CODE))
|
||||
return -1;
|
||||
|
@@ -101,15 +101,15 @@ static int sqlite_log(struct ast_cdr *cdr)
|
||||
ast_mutex_lock(&sqlite_lock);
|
||||
|
||||
t = cdr->start.tv_sec;
|
||||
localtime_r(&t, &tm);
|
||||
ast_localtime(&t, &tm, NULL);
|
||||
strftime(startstr, sizeof(startstr), DATE_FORMAT, &tm);
|
||||
|
||||
t = cdr->answer.tv_sec;
|
||||
localtime_r(&t, &tm);
|
||||
ast_localtime(&t, &tm, NULL);
|
||||
strftime(answerstr, sizeof(answerstr), DATE_FORMAT, &tm);
|
||||
|
||||
t = cdr->end.tv_sec;
|
||||
localtime_r(&t, &tm);
|
||||
ast_localtime(&t, &tm, NULL);
|
||||
strftime(endstr, sizeof(endstr), DATE_FORMAT, &tm);
|
||||
|
||||
for(count=0; count<5; count++) {
|
||||
|
@@ -286,7 +286,7 @@ static void get_date(char *dateField, struct timeval tv)
|
||||
if (!ast_tvzero(tv))
|
||||
{
|
||||
t = tv.tv_sec;
|
||||
localtime_r(&t, &tm);
|
||||
ast_localtime(&t, &tm, NULL);
|
||||
strftime(buf, 80, DATE_FORMAT, &tm);
|
||||
sprintf(dateField, "'%s'", buf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user