How to get current datetime in freeradius?

Christian Strauf strauf at rz.tu-clausthal.de
Wed Oct 2 11:38:49 CEST 2019


Hi Houman,

"%l" gives you POSIX time (seconds since the Unix epoch). You should be able to modify your query like this to make it work (make sure to test it, it's just off the top of my head):

%{sql:SELECT UNIX_TIMESTAMP(expires_at) FROM main_db.`user` WHERE main_db.`user`.username ='%{User-Name}'}

UNIX_TIMESTAMP should convert the date to POSIX time in seconds (unsigned integer).

Kind regards,
Christian Strauf


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5279 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20191002/6d2f2abd/attachment-0001.bin>


More information about the Freeradius-Users mailing list