diff options
| author | Florian Westphal <fw@strlen.de> | 2006-03-11 10:33:30 +0000 |
|---|---|---|
| committer | Florian Westphal <fw@strlen.de> | 2006-03-11 10:33:30 +0000 |
| commit | d39d3ec4b90785895c8a156de42283ef0912650c (patch) | |
| tree | 49112aa7a01cd34f18abd48196e48f0d84f74b2f | |
| parent | 79dfd60a0ccb22561606d35e6732e18086b5092e (diff) | |
| download | ngircd-d39d3ec4b90785895c8a156de42283ef0912650c.tar.gz ngircd-d39d3ec4b90785895c8a156de42283ef0912650c.zip | |
Client_RegisterWhowas(): call time() only once
| -rw-r--r-- | src/ngircd/client.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 624ff1e1..67758ea8 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -17,7 +17,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: client.c,v 1.87 2006/03/11 01:37:31 alex Exp $"; +static char UNUSED id[] = "$Id: client.c,v 1.88 2006/03/11 10:33:30 fw Exp $"; #include "imp.h" #include <assert.h> @@ -1175,11 +1175,13 @@ GLOBAL void Client_RegisterWhowas( CLIENT *Client ) { int slot; + time_t now; assert( Client != NULL ); + now = time(NULL); /* Don't register clients that were connected less than 30 seconds. */ - if( time(NULL) - Client->starttime < 30 ) + if( now - Client->starttime < 30 ) return; slot = Last_Whowas + 1; @@ -1189,7 +1191,7 @@ Client_RegisterWhowas( CLIENT *Client ) Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot ); #endif - My_Whowas[slot].time = time( NULL ); + My_Whowas[slot].time = now; strlcpy( My_Whowas[slot].id, Client_ID( Client ), sizeof( My_Whowas[slot].id )); strlcpy( My_Whowas[slot].user, Client_User( Client ), |