summaryrefslogtreecommitdiff
path: root/accel-pppd/radius/auth.c
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2011-09-05 15:33:28 +0400
committerKozlov Dmitry <xeb@mail.ru>2011-09-05 15:33:28 +0400
commit8a0f7065300efbe6e916ec7e2a298dc8feec1298 (patch)
tree0c2d2931cbf1eedfac073f3ef11ae6aef683c127 /accel-pppd/radius/auth.c
parent3e6a720a2cbd08edb6d04255b2246a833df6825c (diff)
downloadaccel-ppp-8a0f7065300efbe6e916ec7e2a298dc8feec1298.tar.gz
accel-ppp-8a0f7065300efbe6e916ec7e2a298dc8feec1298.zip
radius: use clock_gettime(CLOCK_MONOTONIC) instead of gettimeofday
Diffstat (limited to 'accel-pppd/radius/auth.c')
-rw-r--r--accel-pppd/radius/auth.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c
index c9f66556..becddf6d 100644
--- a/accel-pppd/radius/auth.c
+++ b/accel-pppd/radius/auth.c
@@ -145,7 +145,7 @@ static uint8_t* encrypt_password(const char *passwd, const char *secret, const u
static int rad_auth_send(struct rad_req_t *req)
{
int i;
- struct timeval tv, tv2;
+ struct timespec tv, tv2;
unsigned int dt;
int timeout;
@@ -160,7 +160,7 @@ static int rad_auth_send(struct rad_req_t *req)
for(i = 0; i < conf_max_try; i++) {
__sync_add_and_fetch(&req->serv->stat_auth_sent, 1);
- gettimeofday(&tv, NULL);
+ clock_gettime(CLOCK_MONOTONIC, &tv);
if (rad_req_send(req, conf_verbose))
goto out;
@@ -174,8 +174,8 @@ static int rad_auth_send(struct rad_req_t *req)
if (req->reply->id != req->pack->id) {
rad_packet_free(req->reply);
req->reply = NULL;
- gettimeofday(&tv2, NULL);
- timeout = conf_timeout - ((tv2.tv_sec - tv.tv_sec) * 1000 + (tv2.tv_usec - tv.tv_usec) / 1000);
+ clock_gettime(CLOCK_MONOTONIC, &tv2);
+ timeout = conf_timeout - ((tv2.tv_sec - tv.tv_sec) * 1000 + (tv2.tv_nsec - tv.tv_nsec) / 1000000);
} else
break;
} else
@@ -183,7 +183,7 @@ static int rad_auth_send(struct rad_req_t *req)
}
if (req->reply) {
- dt = (req->reply->tv.tv_sec - tv.tv_sec) * 1000 + (req->reply->tv.tv_usec - tv.tv_usec) / 1000;
+ dt = (req->reply->tv.tv_sec - tv.tv_sec) * 1000 + (req->reply->tv.tv_nsec - tv.tv_nsec) / 1000000;
stat_accm_add(req->serv->stat_auth_query_1m, dt);
stat_accm_add(req->serv->stat_auth_query_5m, dt);
break;