Commit 6700205b authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(leave_conf): Extract the seconds from the current_time.

(login_old): Ditto.
(login): Ditto.
(get_static_session_info): Ditto.
(get_time): Ditto.
(logout): Ditto.  Use timeval_diff_sec instead of ldifftime.
(who_is_on_dynamic): Use timeval_diff_sec instead of ldifftime.
(get_session_info): Ditto.
(get_session_info_ident): Ditto.
parent f756ea58
/*
* $Id: session.c,v 0.66 2003/01/06 13:10:00 ceder Exp $
* $Id: session.c,v 0.67 2003/07/12 21:29:55 ceder Exp $
* Copyright (C) 1991-1994, 1996-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -58,6 +58,7 @@
#include "kom-memory.h"
#include "string-malloc.h"
#include "server-time.h"
#include "timeval-util.h"
/*
* Create an oldstyle username, user%host.domain@host.domain.
......@@ -93,7 +94,7 @@ leave_conf(Connection *conn)
if ((mship = locate_membership( conn->cwc, conn->person ))
!= NULL )
{
mship->last_time_read = current_time;
mship->last_time_read = current_time.tv_sec;
mark_person_as_changed (conn->pers_no);
}
else
......@@ -138,7 +139,8 @@ login_old (Pers_no pers_no,
cached_lock_person(pers_no);
pers_p->last_login = active_connection->session_start = current_time;
pers_p->last_login = current_time.tv_sec;
active_connection->session_start = current_time;
++pers_p->sessions;
s_strcpy(&pers_p->username, active_connection->username);
......@@ -223,7 +225,8 @@ login (Pers_no pers_no,
cached_lock_person(pers_no);
pers_p->last_login = active_connection->session_start = current_time;
pers_p->last_login = current_time.tv_sec;
active_connection->session_start = current_time;
s_strcpy(&pers_p->username, active_connection->username);
......@@ -282,9 +285,9 @@ logout( void )
}
leave_conf(active_connection);
ACT_P->last_login = current_time;
ACT_P->last_login = current_time.tv_sec;
ACT_P->total_time_present +=
ldifftime(current_time, active_connection->session_start);
timeval_diff_sec(current_time, active_connection->session_start);
cached_unlock_person( ACTPERS );
mark_person_as_changed( ACTPERS );
......@@ -555,7 +558,7 @@ who_is_on_dynamic(int want_visible,
include_it = want_visible;
if (active_last != 0
&& ldifftime(current_time, cptr->active_time) > active_last
&& timeval_diff_sec(current_time, cptr->active_time) > active_last
&& cptr->flags.user_active_used)
include_it = 0;
......@@ -580,7 +583,7 @@ who_is_on_dynamic(int want_visible,
include_it = want_visible;
if (active_last != 0
&& ldifftime(current_time, cptr->active_time) > active_last
&& timeval_diff_sec(current_time, cptr->active_time) > active_last
&& cptr->flags.user_active_used)
include_it = 0;
......@@ -591,8 +594,8 @@ who_is_on_dynamic(int want_visible,
result->sessions[i].person = cptr->pers_no;
result->sessions[i].working_conference = filter_conf_no(
cptr->cwc, active_connection);
result->sessions[i].idle_time = ldifftime(current_time,
cptr->active_time);
result->sessions[i].idle_time = timeval_diff_sec(
current_time, cptr->active_time);
result->sessions[i].flags = cptr->flags;
......@@ -635,8 +638,8 @@ get_session_info (Session_no session_no,
result->working_conference = filter_conf_no(cptr->cwc,
active_connection);
result->session = cptr->session_no;
result->connection_time = cptr->session_start;
result->idle_time = ldifftime(current_time, cptr->active_time);
result->connection_time = cptr->session_start.tv_sec;
result->idle_time = timeval_diff_sec(current_time, cptr->active_time);
/* Backward compatibility. result->username is free()d in
prot_a_reply() prot-a.c. */
......@@ -670,7 +673,7 @@ get_static_session_info (Session_no session_no,
result->username = cptr->username;
result->hostname = cptr->hostname;
result->ident_user = cptr->ident_user;
result->connection_time = cptr->session_start;
result->connection_time = cptr->session_start.tv_sec;
return OK;
}
......@@ -701,8 +704,8 @@ get_session_info_ident (Session_no session_no,
result->working_conference = filter_conf_no(cptr->cwc,
active_connection);
result->session = cptr->session_no;
result->connection_time = cptr->session_start;
result->idle_time = ldifftime(current_time, cptr->active_time);
result->connection_time = cptr->session_start.tv_sec;
result->idle_time = timeval_diff_sec(current_time, cptr->active_time);
result->username = cptr->username;
result->hostname = cptr->hostname;
result->ident_user = cptr->ident_user;
......@@ -822,7 +825,7 @@ extern Success
get_time( time_t *clk )
{
CHK_CONNECTION(FAILURE);
*clk = current_time;
*clk = current_time.tv_sec;
return OK;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment