diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-18 19:47:20 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-18 19:47:20 +0000 |
commit | 74c2948c2299773fd3816af43e06e3bdf714ba3a (patch) | |
tree | 540f82bac3e6105b6fc34cd4b4613c1756a7512b /cdr/cdr_radius.c | |
parent | fd471b4a0cbb2abd7b4c8f30fee850cedefedaa1 (diff) |
Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75706 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr/cdr_radius.c')
-rw-r--r-- | cdr/cdr_radius.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/cdr/cdr_radius.c b/cdr/cdr_radius.c index c41d680dd..b344c0b26 100644 --- a/cdr/cdr_radius.c +++ b/cdr/cdr_radius.c @@ -98,7 +98,7 @@ static rc_handle *rh = NULL; static int build_radius_record(VALUE_PAIR **send, struct ast_cdr *cdr) { int recordtype = PW_STATUS_STOP; - struct tm tm; + struct ast_tm tm; char timestr[128]; char *tmp; @@ -143,29 +143,23 @@ static int build_radius_record(VALUE_PAIR **send, struct ast_cdr *cdr) /* Start Time */ - if (ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME)) - gmtime_r(&(cdr->start.tv_sec), &tm); - else - ast_localtime(&(cdr->start.tv_sec), &tm, NULL); - strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm); + ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, + ast_localtime(&cdr->start, &tm, + ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL)); if (!rc_avpair_add(rh, send, PW_AST_START_TIME, timestr, strlen(timestr), VENDOR_CODE)) return -1; /* Answer Time */ - if (ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME)) - gmtime_r(&(cdr->answer.tv_sec), &tm); - else - ast_localtime(&(cdr->answer.tv_sec), &tm, NULL); - strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm); + ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, + ast_localtime(&cdr->answer, &tm, + ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL)); if (!rc_avpair_add(rh, send, PW_AST_ANSWER_TIME, timestr, strlen(timestr), VENDOR_CODE)) return -1; /* End Time */ - if (ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME)) - gmtime_r(&(cdr->end.tv_sec), &tm); - else - ast_localtime(&(cdr->end.tv_sec), &tm, NULL); - strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm); + ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, + ast_localtime(&cdr->end, &tm, + ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL)); if (!rc_avpair_add(rh, send, PW_AST_END_TIME, timestr, strlen(timestr), VENDOR_CODE)) return -1; |