[ previous ] [ next ] [ threads ]
 
 From:  "Jonathan De Graeve" <Jonathan dot De dot Graeve at imelda dot be>
 To:  <maruna at monarchng dot com>, "FreeRadius users mailing list" <freeradius dash users at lists dot freeradius dot org>
 Cc:  <m0n0wall at lists dot m0n0 dot ch>
 Subject:  RE: RE: access for 24 hours after first login?
 Date:  Thu, 6 Oct 2005 22:45:07 +0200
>It doesn't work on postgresql v7.4.6 that I tried it on.. howver, I
used 
>
>"SELECT now() - AcctStartTime FROM radacct WHERE UserName = '%{%k}'
>LIMIT 1;"
>

Be carefull with this!!!!!


"SELECT now() - AcctStartTime Secs
FROM radacct 
WHERE UserName = '%{k}' LIMIT 1;" 

Gives for example with username 'test': 
+-----------+
| Secs      |
+-----------+
| 684042112 |
+-----------+

Recalculated in days: 7917,1540740740740740740740740741 days....

Is NOT the same as: 

"SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) Secs 
FROM radacct
WHERE UserName = '%{%k}' LIMIT 1"

Gives for example with username 'test':
+----------+
| Secs     |
+----------+
| 17119330 |
+----------+

Recalculated in days: 198,14039351851851851851851851852

198days is the correct calculation...

So as you can see, it isn't the same, at least in MySQL, don't know with
other databases.
So before you you begin: think, try and check your things.

J.