Originally posted by dugawug
now i'm pretty confused...first you said client time had nothing to do with it, now you're saying i have to get the local time and work with it?
I'm saying that I now believe my initial statement to be wrong. Based on my knowledge that the server set the expire time I developed the supposition that the server also used this time to decide when to stop accepting a cookie. However, after reading the netscape article quoted in my previous post I now believe that the browser decides if it should send the cookie based on the expire parameter so it does use the client time.
this all seems so complicated for such a simple thing. i just want a session and to have it expire after a specific time of inactivity to anyone no matter what time zone they are in.
The expire parameter is irrelevent to timezone. All expire parameters are supposed to be used as if they are set in GMT. So timezone conversions should happen on the clientside for you. However if the client's clock is a couple of minutes off that could affect the life of the cookie.
i can't believe such a simple thing requires so much effort!??
Welcome to programming. As Turin said "programming is 90% boring, redundancy, 14.5% bug fixing and 0.5% fun stuff.
can anyone tell me it doesn't before i go coding away?
I would say test it more fully before you begin codding it here are some tests you can run:
1) Set your clock five minutes slower then the server and set the cookie to expire one minute ago. If the expire is based on the client time this cookie will be active for 4 minutes.
2) Set your clock find minutes faster then the server and set the cookie to expire in six minutes. If the expire is based on the client time this cookie will be active for 1 minute.
3) Put your computer into a different timezone with your OS timezone setting and allow the clock to be adjusted accordingly.
4) Repeat steps 1 and 2, however add the hours for the time zone difference into the time differences. (For example if you move one time zone into the future then for step one set your clock 55 minutes slower then the server) Note if the timezone change, and appropriate time change on your machine, affects the life of the cookies. If the life of the cookie is not affected then timezone is not a factor only the person's clock being wrong is.
My supposition is that steps 1 & 2 will turn out that the time change affects cookie life and step 4 will turn out that timezone does not affect cookie life.
There is another way around this, which I implemented at a previous job. Grab the user's localtime and timezone. Convert this into a difference between gmt on the server and gmt on the client. Then if that absolute difference is larger then x post a page that informs them so adjust their computer's time accordingly.