From: Alan T. DeKok Date: Sun, 6 Apr 2025 10:14:26 +0000 (-0400) Subject: print out scale and raw values for time_delta X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d14a58b26ec6274520200879bc4d41c568d7ebf1;p=thirdparty%2Ffreeradius-server.git print out scale and raw values for time_delta --- diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 25abca8fd53..e674db3aebc 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -6425,25 +6425,37 @@ void fr_value_box_list_debug(fr_value_box_list_t const *head) static void _fr_value_box_debug(fr_value_box_t const *vb, int depth, int idx) { char *value; + char buffer[64]; if (fr_type_is_structural(vb->type)) { _fr_value_box_list_debug(&vb->vb_group, depth + 1); return; } + buffer[0] = '\0'; + if (vb->type == FR_TYPE_TIME_DELTA) { + if (!vb->enumv) { + snprintf(buffer, sizeof(buffer), " (sec!) %" PRId64, fr_time_delta_unwrap(vb->vb_time_delta)); + } else { + snprintf(buffer, sizeof(buffer), " (%s) %" PRId64, + fr_table_str_by_value(fr_time_precision_table, vb->enumv->flags.flag_time_res, "?"), + fr_time_delta_unwrap(vb->vb_time_delta)); + } + } + fr_value_box_aprint(NULL, &value, vb, NULL); if (idx >= 0) { INFO_INDENT("[%d] (%s) %s", idx, fr_type_to_str(vb->type), value); - INFO_INDENT(" %s %s %lx", + INFO_INDENT(" %s %s %lx%s", vb->secret ? "s" : "-", vb->tainted ? "t" : "-", - vb->safe_for); + vb->safe_for, buffer); } else { INFO_INDENT("(%s) %s", fr_type_to_str(vb->type), value); - INFO_INDENT(" %s %s %lx", + INFO_INDENT(" %s %s %lx%s", vb->secret ? "s" : "-", vb->tainted ? "t" : "-", - vb->safe_for); + vb->safe_for, buffer); } talloc_free(value); }