Alan, many thanks !

although it took me some time, "simple Math" isn't one of my real strenghts 
and I still haven't fully understood ;), I worked out now to disconnect at 04:00 CEST 
/ 03:00 CET
(Timestamp is GMT, I should have remembered):

                Session-Timeout = `%{expr:86400 - ((%l - 7200) %% 86400)}`


Michael

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Alan
DeKok
Sent: Friday, April 23, 2004 11:19 PM
To: [EMAIL PROTECTED]
Subject: Re: session-timeout for diconnect at fixed time 


"Michael Markstaller" <[EMAIL PROTECTED]> wrote:
> I played around with rlm_sqlcounter but had no success so far, maybe
> there's a simple idea out there to calculate the seconds until its'
> 03:30 ?

  Math.  See rlm_expr.

  To disconnect people at midnight every day, calculate the time left
until the next midnight.

  Session-Timeout := `%{expr: ((%l + 86399) %% 86400) - %l}`

  To disconnect people at 3:30... it gets a little more complicated.

  Time since the previous midnight:

        %l - (%l %% 86400)

  Time since the previous 3:30am:

        (%l - 12600) - ((%l - 12600) %% 86400)

  Time until the next 3:30 am is one day, less the time since the
previous 3:30 am.

        86400 - (%l - 12600) - ((%l - 12600) %% 86400)

   Or, 

        86400 + 12600 + ((%l - 12600) %% 86400) - %l.

  e.g. "one day, plus time until 3:30, plus the time of the previous
day it was 3:30, and subtract from that the current time".

  The complicated nature of the calculation is due to the fact that
when people log in at 02:30, you want to disconnect them at 03:30, and
when they log in at 04:30, to disconnect at the next 03:30.

  You can't do comparisons in rlm_expr, so it's easier to make the
calculations a little more complex.

  Alan DeKok.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to