From: Alan T. DeKok Date: Mon, 25 Sep 2023 21:19:36 +0000 (-0400) Subject: move to local variables, and away from Tmp-* X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21044084e0f9616fde5870de1d5dbdafa15b63cb;p=thirdparty%2Ffreeradius-server.git move to local variables, and away from Tmp-* --- diff --git a/doc/antora/modules/reference/pages/xlat/builtin.adoc b/doc/antora/modules/reference/pages/xlat/builtin.adoc index 0328838fbb5..8e7119ab5fb 100644 --- a/doc/antora/modules/reference/pages/xlat/builtin.adoc +++ b/doc/antora/modules/reference/pages/xlat/builtin.adoc @@ -1109,11 +1109,19 @@ UTC by using the following steps: .Example Calculating the UTC value of "tomorrow" [source,unlang] ---- -&Tmp-Date-0 := %(time:request) +group { + date now + date tomorrow + time_delta time_of_day -&Tmp-Time-Delta-0 := &Tmp-Date-0 % (time_delta) 1d + &now := %(time:request) -&Tmp-Date-1 := &Tmp-Date-0 - &Tmp-Time-Delta-0 + # We are this many seconds into one day + &time_of_day := &now % (time_delta) 1d + + # calculate the start of today, and then add one day to that + &tomorrow := &now - &time_of_day + (time_delta) 1d +} ---- The following example calculates the correct value of "tomorrow" in @@ -1123,13 +1131,22 @@ time zone offset to the final value. .Example Calculating the local value of "tomorrow" [source,unlang] ---- -&Tmp-Date-0 := %(time:request) +group { + date now + date tomorrow + time_delta time_of_day -&Tmp-Time-Delta-0 := &Tmp-Date-0 % (time_delta) 1d + &now := %(time:request) -&Tmp-Date-1 := &Tmp-Date-0 - &Tmp-Time-Delta-0 + (time_delta) 1d + # We are this many seconds into one day + &time_of_day := &now % (time_delta) 1d -&Tmp-Date-1 += %(time:offset) + # calculate the start of today, and then add one day to that + &tomorrow := &now - &time_of_day + (time_delta) 1d + + # add in the time zone offset + &tomorrow += %(time:offset) +} ---- This kind of math works well for "tomorrow", but it is less useful for