Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

strange thing with date_offset variable

Quote Reply
strange thing with date_offset variable
Hi,

I noticed that the date_offset variable in control panel affects not only the current time of the forum but also the time of all posts. I understand why the date_offset affects the current time of the forum, but I don't understand why it affects also the time of all posts.

For example: I choose another webhosting company in another GMT zone. I can see the advantage to set the date_offset to get the current time of my home (of my last webhosting company). But what is the advantage to change also the time of all the posts, since I'm not living in the GMT zone of my new webhosting company and also since all my users didn't change too of GMT zone? Can someone explain me this?

I think the variable date_offset in control panel should affect only the current time of the forum. Maybe a option to choose if or not the date_offset variable affects the time of all the post would be a nice idea.

Thank you.

François

Last edited by:

Franco: Nov 9, 2002, 9:53 AM
Quote Reply
Re: [Franco] strange thing with date_offset variable In reply to
Hi François,

The date_offset variable is really nothing more than a "default" time offset for users.

For example, let's say you move your server from GMT-8 to GMT-5 - without the timezone offset, all of your posts will have appeared to have changed - if I posted something at 5:00, it will now appear to have been posted at 8:00. It's also useful to show the post times in another timezone than the server. For example, let's say my server is in GMT-5, but hosts a forum which has most of its members in GMT-8 - I would then set the time_offset to -3 hours so that most users don't have to adjust their individual time zone offsets in their profiles to adjust the times they see.

Basically, the time displayed is determined as follows:
  • The database _always_ stores the post in unix time, which is time-zone independent.
  • The admin panel variable, 'time_offset' is applied to the time, adjusting it as necessary.
  • If the user is logged in, the time zone offset they have specified in there profile is also added (or subtracted) from the time.
  • Finally, whatever the time has been changed to is displayed using the date format.


So, if you don't set the time_offset, everyone is going to see the actual server's time as the current time. The main purpose is to make it look like the server's time is actually different from what it really is. But again, since the posts are always stored in a timezone-independent format, the time_offset does not affect the actual time of any or future posts - posts are always posted as "now" - and "now" in Vancouver is the same as "now" in France, or China, or anywhere else in the world. time_offset only affects the dates and times displayed - it has no effect on the database whatsoever.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] strange thing with date_offset variable In reply to
Hi Jason,

Thank you for your answer. But I think you don't understand me completely. Maybe it's because of my poor english.

Here the problem:
If I move my server from GMT -8 to GMT -5, I will have to set the date_offset to -3 to keep the forum time at the same time than before (GMT -8). But by setting the date_offset to -3, all the post times will appear 3 hours late: a post posted at 8:00 will appear to be posted at 5:00, because the date_offset will be set to -3.
Here we just need to set the time of the forum but not also the displayed time of all the posts. But the date_offset variable affect the current time of the forum and all the displayed times of the posts.

To avoid this problem I think there should be in the control panel a date_offset variable for the current time of the forum and a second date_offset for the displayed times of the posts.

Thank you again.

François
Quote Reply
Re: [Franco] strange thing with date_offset variable In reply to
Hi François,

The point I was trying to make earlier was that it doesn't matter what time zone the server is in: -3, -8, +7 - it does not matter, because the time is always stored in GMT. So, a post posted at 8:00 GMT will always be posted at 8:00 GMT, no matter where the server is, or where the server moves to.

However, when Gossamer Forum tries to display a date, it converts this GMT time to the local time for display purposes. Let's say you server is in -5, and you are not using a time offset (it is set to 0). You make a post, and it shows up as having been posted at 8:00 - this 8:00 is, of course, in the -5 timezone.

Now, you decide to move your server west, to the -8 timezone, but don't change the time offset. Your post will now show up as having been posted at 5:00 - which is correct, since 5:00 in GMT-8 is the same as 8:00 in GMT-5.

But you don't want it to show up like that. You want the times that GForum shows to be the times in GMT-5 - not GMT-8, where the server is. So you set the time_offset to 3 hours. After adjusting it, the post shows as having been posted at 8:00 again. If I then make another post, from GMT-5, again at 8:00, it will show at 8:00. If I make a post from GMT-8 at 8:00, it will show as 11:00 - since, 8:00 in GMT-8 is 11:00 in GMT-5.

The purpose of the the time_offset is specifically so that I can seemlessly move the server to another timezone, without affecting the times displayed on the forum.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] strange thing with date_offset variable In reply to
Hi Jason,

I think I found why I didn't completely understand you the first time. My webhosting company did not remove one hour for the Daylight Savings time. So, to get the right current time on my forum (in Who's Online page, for example), I put the date_offset to -1, but this caused that all the displayed dates of the posts appeared 1 hour late.

I didn't know that the time on the server and the GMT setting of the server was two distinct server configurations. Am I right?? Does this explain why the displayed dates of the posts appeared 1 hour late, after I set the date_offset to -1 to get the correct current time (in Who's online page)?

Thank you!

François

Last edited by:

Franco: Nov 18, 2002, 5:10 AM
Quote Reply
Re: [Franco] strange thing with date_offset variable In reply to
Hi François,

Yes, the time on the server is based on the server's configuration; if it doesn't update for daylight savings, you have to update yourself (via the time_offset). Basically, what you want to do is adjust time_offset so that the posts show up at the right time (try making a test post, or sending yourself a private message, and see if the time is correct). So, if -1 makes them show up an hour late, set it to -2.

I'll make a note to add a little note such as "The current time is ______" beside the time_offset in the admin and the user one for version 2.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] strange thing with date_offset variable In reply to
Hi Jason,

The posts posted after I set the time_offset to -1 are correct (they show the right time). It's only for the posts posted before I set the time_offset to -1 that appear now one hour late.

Please try this test:
1) Send a post in your forum and note its displayed time.
2) Add one hour to the clock of the server where your forum is installed, like if you were (change server) in another time zone.
3) Check the time of the post you posted in step 1. You will see that its displayed time didn't change.
4) Check the current time of your forum throw the Who's Online page. You will see that the current time of your forum is now 1 hour in advance.
5) In the control panel set the time_offset (date_offset) of your forum to -1 to get the right current time displayed in your forum (in Who's Online page).
6) Verify the current time of your forum (in Who's Online page). You will see that the current time of your forum is now correct.
7) Check now the post you've posted in the step 1. You will see that the displayed time of this post is now 1 hour late.
So it's seem that it's not possible to have at the same time the right current time in the forum (displayed in Who's Online page and used for new posts) and the right time of the post posted in step 1. That's why I suggest to have a time_offset for the current time of the forum and another time_offset for the displayed times of all the posts.

Please let me know how this test went for you.

Thank you.

François

Last edited by:

Franco: Nov 18, 2002, 7:19 AM
Quote Reply
Re: [Franco] strange thing with date_offset variable In reply to
Hi François,

It sounds to me like the server time was (or is) off - as if the server thinks that GMT time is an hour off from what GMT really is.

Try this command, via FileMan -> Command:

perl -e 'print scalar gmtime'

See if the time it prints is the correct GMT time.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] strange thing with date_offset variable In reply to
Hi Jason,

It prints "Mon Nov 18 14:54:31 2002" and it's should be "Mon Nov 18 09:54:31 2002". I don't understand because the current time of my forum is correct and the time_offset is set to 0 (they set the time server correctly since two days).

Crazy

François
Quote Reply
Re: [Jagerman] strange thing with date_offset variable In reply to
I suppose that my test gives not the same results on your server. May I know what are the differences?

Thank you!

François
Quote Reply
Re: [Jagerman] strange thing with date_offset variable In reply to
Oups, since I'm in GMT -5 the time of my server seem to be correct. I'm right?