MT#55283 modernise timeval_subtract

Change-Id: I7715ee92e12e88d69e3f714a6714f691646e240c
pull/1910/head
Richard Fuchs 4 months ago
parent 5dd0a387a3
commit 21de8d4b94

@ -3901,7 +3901,7 @@ static struct timeval add_ongoing_calls_dur_in_interval(struct timeval *interval
if (timercmp(interval_start, &ml->started, >)) {
res = timeval_add(&res, interval_duration);
} else {
timeval_subtract(&call_duration, &rtpe_now, &ml->started);
call_duration = timeval_subtract(&rtpe_now, &ml->started);
res = timeval_add(&res, &call_duration);
}
next:

@ -60,7 +60,7 @@ void cdr_update_entry(call_t * c) {
ml->term_reason = UNKNOWN;
}
timeval_subtract(&tim_result_duration,&ml->terminated,&ml->started);
tim_result_duration = timeval_subtract(&ml->terminated, &ml->started);
if (_log_facility_cdr) {
g_string_append_printf(cdr,

@ -726,7 +726,7 @@ static void cli_list_tag_info(struct cli_writer *cw, struct call_monologue *ml)
else
now = ml->terminated;
timeval_subtract(&tim_result_duration, &now, &ml->started);
tim_result_duration = timeval_subtract(&now, &ml->started);
cw->cw_printf(cw, "--- Tag '" STR_FORMAT "', type: %s, label '" STR_FORMAT "', "
"branch '" STR_FORMAT "', "

@ -863,7 +863,7 @@ static void control_ng_process_payload(ng_ctx *hctx, str *reply, str *data, cons
// stop command timer
gettimeofday(&cmd_stop, NULL);
//print command duration
timeval_subtract(&cmd_process_time, &cmd_stop, &cmd_start);
cmd_process_time = timeval_subtract(&cmd_stop, &cmd_start);
if (command_ctx.opmode >= 0 && command_ctx.opmode < OP_COUNT) {
mutex_lock(&cur->cmd[command_ctx.opmode].lock);

@ -356,8 +356,8 @@ INLINE struct timeval timeval_from_us(long long ms) {
INLINE long long timeval_diff(const struct timeval *a, const struct timeval *b) {
return timeval_us(a) - timeval_us(b);
}
INLINE void timeval_subtract(struct timeval *result, const struct timeval *a, const struct timeval *b) {
*result = timeval_from_us(timeval_diff(a, b));
INLINE struct timeval timeval_subtract(const struct timeval *a, const struct timeval *b) {
return timeval_from_us(timeval_diff(a, b));
}
INLINE struct timeval timeval_add(const struct timeval *a, const struct timeval *b) {
return timeval_from_us(timeval_us(a) + timeval_us(b));

Loading…
Cancel
Save