From: Alan T. DeKok Date: Thu, 19 Jan 2023 17:28:26 +0000 (-0500) Subject: special-case (date - date) --> time_delta X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1e878dfe069b1ddc29b9e7b19c73efac5f8d8e1;p=thirdparty%2Ffreeradius-server.git special-case (date - date) --> time_delta --- diff --git a/src/lib/util/calc.c b/src/lib/util/calc.c index 4ad7d9659fa..421342a27ae 100644 --- a/src/lib/util/calc.c +++ b/src/lib/util/calc.c @@ -1811,6 +1811,14 @@ int fr_value_calc_binary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t hint * guess based on a variety of factors. */ if (hint == FR_TYPE_NULL) do { + /* + * All kinds of special cases :( + */ + if ((op == T_SUB) && (a->type == b->type) && (a->type == FR_TYPE_DATE)) { + hint = FR_TYPE_TIME_DELTA; + break; + } + switch (op) { case T_OP_CMP_EQ: case T_OP_NE: