What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » General » Forum & Website » [split] Daylight savings time bug

[split] Daylight savings time bug
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
O.P. RE: Daylight savings! :banana:
Fishy already knows this (and he was not happy hearing it :p), but there is major bug with DST in mybb, Invision Power Board (and possible all other boards too)....

Posttimes of the past are also changed when you set/unset DST in your profile. This is plain wrong. When a post has been posted 10 days ago at 10am GMT, it still is posted at 10am 10 days ago, not at 9am or 11am...

Switching on/off the DST shouldn't change the times prior to the switching on/off!

The problem is: Posttimes are calculated when you view the thread. But with this calculation, the current DST-setting is also taken in account, which is wrong to do. The DST should be saved together with the post, not calculated afterwards.

What should be done is, eg:
* DST is ON for me. If I post a message on september 1st, at 10am GMT (my localtime), then 11am GMT should be saved, not 10am GMT, because it IS actually 11am GMT for me.
* DST is OFF for me. If I post a message on september 1st, at 10am GMT (my localtime), then 10am GMT should be saved, as normal.

Afterwards, the calculation/convertion to the localtime of the reader is still calculated of course, but without the DST's taken in account (of either poster and reader).

Because for me the message was still posted respectivly at 11am and 10am on september 1st. For the reader (even regardless of his DST setting) this also still would be, eg: 6am GMT-5 and 5am GMT-5, september 1st...

This post was edited on 11-01-2004 at 07:00 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-01-2004 06:50 PM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Daylight savings! :banana:
quote:
Originally posted by CookieRevised
and possible all other boards as well
This is the key sentence. :D

Seriously, I don't think the hassle of storing DST values and complicating the calculations is worth the benefit. Just thinking of coding such a feature makes my brain go "arrrghhh!!!!!!!1" :p
11-01-2004 06:57 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
O.P. RE: Daylight savings! :banana:
quote:
Originally posted by WDZ
This is the key sentence.
hmmm, so??? In fact, it should encourage you, making this the first board which integrates DST correctly!! :undecided:

Seriously, there is nothing complicated with it.

Instead of storing 10am when DST is on, store 11am.
If DST is off then store 10am (as useuall):

And also remove the DST calculation for when the times are calculated when you view posts!...

When the posttimes are stored:
code:
posttime = "10:00"
IF DST = on Then
  posttime = posttime + 1
End If
It is as simple as this....



In fact, all this makes that the calculation for converting the times to the localtime of the reader is made much simpler (and slightly faster, cause DST settings doesn't need to be looked anymore when people view threads).



(PS: the key sentence should be: you can't change dates/times in the past, unless you have the timemachine from professor Barabas -dutch people know what I'm talking about :p-)

This post was edited on 11-01-2004 at 07:12 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-01-2004 07:06 PM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Daylight savings! :banana:
I don't get it. My brain isn't capable of absorbing such things, especially after only 5 hours of sleep. :p

Why store the DST setting of the poster? What if the DST setting of the viewer is different from that? :-/

quote:
hmmm, so???
The fact that nobody else has done it means that I shouldn't be expected to do it, and it's a good excuse not to. :p
11-01-2004 07:16 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
O.P. RE: Daylight savings! :banana:
quote:
Originally posted by WDZ
Why store the DST setting of the poster?
Because it is the correct way... Because, his posting time depends on his DST setting, not on mine...

quote:
Originally posted by WDZ
What if the DST setting of the viewer is different from that?
That's the point, it doesn't matter :D If someone has posted a message at 10am on Sept 1st, that would still be 10am Sept 1st regardless if I'm in DST now or not. Like I said, you can't change times in the past. 10am in the past is 10am... that time doesn't change when you set DST now or not.

PS: get some sleep first ;)

quote:
Originally posted by WDZ
The fact that nobody else has done it means that I shouldn't be expected to do it, and it's a good excuse not to.
No, it means that everybody copied from eachother without thinking because they cba to think about it and it was already late :refuck:
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-01-2004 08:23 PM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: [split] Daylight savings time bug
quote:
Originally posted by CookieRevised
Because it is the correct way... Because, his posting time depends on his DST setting, not on mine...
:huh:

The time shown by the post is the time it was in the viewer's time zone when the post was made.

If it's 3:35 here, and 9:35 in Belgium, at the moment you post, the time shown to me must be 3:35, regardless of what your DST setting is. :^)
11-01-2004 08:37 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
O.P. RE: [split] Daylight savings time bug
quote:
Originally posted by WDZ
If it's 3:35 here, and 9:35 in Belgium, at the moment you post, the time shown to me must be 3:35, regardless of what your DST setting is.
no, (I underlined the things which are related)...

If it is 9:35 in Belgium at the time I posted the message, that time depends on the DST setting of the time I posted the message.

In other words it can be 9:35 (DST on) for me when I posted the message, yet 8:35 will be stored (the method used now). And thus you will see 2:35 instead, thus this is wrong because at the time of posting 9:35 for me was 3:35 for you...

You can't calculate the DST difference when you view the time, you need to calculate it when you store the time.



Another way of looking at it:

My DST is enabled. I'm viewing a thread and the first post is posted at 12:43.
This means this is posted right after midday in the timeframe of a day.

When I need to disable my DST setting, and I look again at that post, it suddenly is posted before midday (11:43)...

This isn't correct as times in the past can not suddenly change.

This post was edited on 11-01-2004 at 09:13 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-01-2004 08:57 PM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: [split] Daylight savings time bug
quote:
Originally posted by CookieRevised
In other words it can be 9:35 (DST on) for me when I posted the message, yet 8:35 will be stored (the method used now). And thus you will see 2:35 instead, thus this is wrong because at the time of posting 9:35 for me was 3:35 for you...
Based on your profile, you posted your reply at 9:57 PM (your time). The time I see is 3:57 PM. That's the correct time. :-/

Blah... I hate it when I can't understand something like this... I don't know who's wrong... :p

quote:
I underlined the things which are related
Well, the "9:35" is irrelevant... I only included it as an example. The point is that if it's 3:35 here when you post, the time shown to me is 3:35, and your DST setting doesn't matter.

quote:
My DST is enabled. I'm viewing a thread and the first post is posted at 12:43.
This means this is posted right after midday in the timeframe of a day.

When I need to disable my DST setting, and I look again at that post, it suddenly is posted before midday (11:43)...
That part (the problem) I understand. It's the solution I'm having trouble with.

quote:
This isn't correct as times in the past can not suddenly change.
Well, they can when a new time zone offset is applied to them. :p The DST option effectively increments your time zone setting by 1.
11-01-2004 09:26 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
O.P. RE: [split] Daylight savings time bug
quote:
Originally posted by WDZ
Well, the "9:35" is irrelevant... I only included it as an example. The point is that if it's 3:35 here when you post, the time shown to me is 3:35, and your DST setting doesn't matter.
No, the time shown to you wouldn't be 3:35, but 2:35, because DST wasn't saved with the posttime. If it was saved (like I suggest) you _will_ see 3:35, but only when it is saved _with_ the posttime, not when it is calculated when you view the time... see PS note below

quote:
Originally posted by WDZ
Based on your profile, you posted your reply at 9:57 PM (your time). The time I see is 3:57 PM. That's the correct time.
Because DST is off atm. This isn't a valid example because DST = 0 atm, so regardless when you add it at storing time or calculate it afterwards, the result will be the same ;)

quote:
Originally posted by WDZ
Well, they can when a new time zone offset is applied to them.
No, the GMT time must still be the same...
If you apply another timezone, the actual time (universal time) isn't changed.
5 GMT = 4 GMT-1, but UTC is still 5.


PS: I'm getting a headache now too :p

maybe my solution isn't the solution afterall, but there sure is a problem with the viewing times........

wild thought (without much thinking because of late hour (how irronic :P) and headache): what if the times are calculated when viewed, but only take in account DST for the posts that were actually posted when DST was on? <= doesn't make much sense now, I'll explain further tommorow (or delete it) :p

This post was edited on 11-01-2004 at 10:00 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-01-2004 09:44 PM
Profile PM Find Quote Report
surfichris
Former Admin
*****

Avatar

Posts: 2365
Reputation: 81
Joined: Mar 2002
RE: [split] Daylight savings time bug
Bah. Cookie, there's one thing you don't understand about it. We can't store the value of DST for EVERY user for EVERY post. Thats x*y = huge z. You don't understand how the php time() function works - it stores the time since unix epoch. It does not store GMT time. Its stored as a numerical (bigint) value in the database. Time since epoch is like GMT time, but it is not GMT time.

Here's the solution i've thought up. A new column in the users table along side the 'dst' one, called 'dstchanged' which stores the time the dst value was last changed.

When calculating post/time stamps it compares the values and if time > dstchanged & dst = on, we'll change the value accordingly, else we don't do anything to the time.. Something like that.
11-06-2004 03:10 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On