@ -125,6 +125,14 @@ int core2strar(struct sip_msg *req, str *c_vals, int *i_vals, char *t_vals)
struct hdr_field * from ;
struct hdr_field * to ;
struct timeval tv ;
struct timezone tz ;
struct tm * tm ;
uint64_t time_hires ;
gettimeofday ( & tv , & tz ) ;
tm = localtime ( & tv . tv_sec ) ;
/* method : request/reply - cseq parsed in acc_preparse_req() */
c_vals [ 0 ] = get_cseq ( req ) - > method ;
t_vals [ 0 ] = TYPE_STR ;
@ -174,6 +182,10 @@ int core2strar(struct sip_msg *req, str *c_vals, int *i_vals, char *t_vals)
t_vals [ 5 ] = TYPE_STR ;
acc_env . ts = time ( NULL ) ;
time_hires = ( tv . tv_sec * 1000 ) + tv . tv_usec / 1000 ;
acc_env . time_hires = time_hires ;
return ACC_CORE_LEN ;
}
@ -306,7 +318,8 @@ static void acc_db_init_keys(void)
db_keys [ n + + ] = & acc_sipcode_col ;
db_keys [ n + + ] = & acc_sipreason_col ;
db_keys [ n + + ] = & acc_time_col ;
time_idx = n - 1 ;
db_keys [ n + + ] = & acc_time_hires_col ;
time_idx = n - 2 ;
/* init the extra db keys */
for ( extra = db_extra ; extra ; extra = extra - > next )
@ -322,6 +335,7 @@ static void acc_db_init_keys(void)
VAL_NULL ( db_vals + i ) = 0 ;
}
VAL_TYPE ( db_vals + time_idx ) = DB1_DATETIME ;
VAL_TYPE ( db_vals + time_idx + 1 ) = DB1_DOUBLE ;
}
@ -380,7 +394,8 @@ int acc_db_request( struct sip_msg *rq)
VAL_STR ( db_vals + i ) = val_arr [ i ] ;
/* time value */
VAL_TIME ( db_vals + ( m + + ) ) = acc_env . ts ;
VAL_DOUBLE ( db_vals + ( m + + ) ) = ( ( double ) acc_env . time_hires ) / 1000 ;
i = m ;
/* extra columns */
m + = extra2strar ( db_extra , rq , val_arr + m , int_arr + m , type_arr + m ) ;