diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-07-18 19:47:20 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-07-18 19:47:20 +0000 |
commit | 81bc1d7af5886089bcd065382476f202ad7cc9ea (patch) | |
tree | 540f82bac3e6105b6fc34cd4b4613c1756a7512b /cdr/cdr_radius.c | |
parent | b96fde308cd75eb17e5fdb0ea6d54c0f1f593ff9 (diff) |
Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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; |