Keeping an online timer
Ok i am curious to how to best make this:
I have a server people can log into. Whenever they log in i wish to manage a timer on them for how long they have been online the server, both the current session and a total timer for how long they have been online.
If i use the Date class for this, how should i proceed? Anyone can post some exampled?
[364 byte] By [
aeona] at [2007-10-2 6:45:30]

Hi,
When the user hits your firdt page you can have a variable in the
session scope which will capture the current server time.
When the user logs off /closes you can invalidate the session.
and capture the server time. and take the difference.
You need to also look into session time out configuration in web.xml.
For total time online which spans across many sessions
keep track of it using an application scope attribute.
Ahhh. This server is written entierly custom in java.
I can get the Date object from when they log in and log off, and i can get the Date object from when they first made the account on the server.
Using these, how do you actually add up the total time, and figure out the current session online time.
aeona at 2007-7-16 13:54:06 >
