Module: kamailio
Branch: master
Commit: 4fe259ab61212bed926cff8380239980b4fe6b19
URL:
https://github.com/kamailio/kamailio/commit/4fe259ab61212bed926cff838023998…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-06-28T12:38:23+02:00
acc: proper value for double representation of time for db accouting on 32b
---
Modified: modules/acc/acc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4fe259ab61212bed926cff838023998…
Patch:
https://github.com/kamailio/kamailio/commit/4fe259ab61212bed926cff838023998…
---
diff --git a/modules/acc/acc.c b/modules/acc/acc.c
index 430dca5..8d0d01c 100644
--- a/modules/acc/acc.c
+++ b/modules/acc/acc.c
@@ -443,6 +443,7 @@ int acc_db_request( struct sip_msg *rq)
int i;
int o;
struct tm *t;
+ double dtime;
/* formated database columns */
m = core2strar( rq, val_arr, int_arr, type_arr );
@@ -458,8 +459,9 @@ int acc_db_request( struct sip_msg *rq)
VAL_INT(db_vals+(m++)) = (int)acc_env.tv.tv_usec;
i++;
} else if(acc_time_mode==2) {
- VAL_DOUBLE(db_vals+(m++)) = ((double)(acc_env.tv.tv_sec * 1000)
- + (acc_env.tv.tv_usec / 1000)) / 1000;
+ dtime = (double)acc_env.tv.tv_usec;
+ dtime = (dtime / 1000000) + (double)acc_env.tv.tv_sec;
+ VAL_DOUBLE(db_vals+(m++)) = dtime;
i++;
} else if(acc_time_mode==3 || acc_time_mode==4) {
if(acc_time_mode==3) {