PDA

View Full Version : Daylight Savings??


SnapOff Racing
10-31-2009, 10:13 PM
I am wondering about Daylight savings which will kick in tonight at midnight. This will cause the time to go BACK an hour.

I run my forum on my own personal server here at home. I know that at midnight my server will shift the time automatically back an hour. But the issue that I am wondering about is when that happens 12am will then become 11pm. But so what will happen to all the posts that were made AFTER 11pm because now any NEW POSTS that are made will cause them to appear BEFORE the other posts.

For example.

~BEFORE DST TAKES EFFECT~
11:18pm User1 creates a thread called "My Thread"
11:26pm User2 makes a reply and says "Nice Thread"

~AFTER DST TAKES EFFECT~
11:20pm User3 makes a reply to the same thread and says "This thread is cool"

But now User3's reply which WOULD HAVE BEEN MADE at 12:20AM will end up going BEFORE User2's reply because DST kicked in and now User3's posts was made at 11:20pm.

So essentially the thread which would look like this BEFORE ANY DST CHANGES
11:18pm User1"My Thread"
11:26pm User2"Nice Thread"
12:20am User3"This thread is cool"

would now look like this AFTER DST CHANGES
11:18pm User1"My Thread"
11:20pm User3"This thread is cool"
11:26pm User2"Nice Thread"


How am I going to get around this? Am I just gonna have to shut my forums down for an hour so that I can wait for the time to catch up?

Brandon Sheley
10-31-2009, 10:30 PM
I wouldn't worry about it, and I wouldn't shut the forums down ;)

SnapOff Racing
10-31-2009, 10:58 PM
Well that explains everything then :rolleyes:

Really man I'm looking for a little more of an explanation than "Don't worry about it, it will be fine"

Paul M
10-31-2009, 11:05 PM
What you describe will simply not happen.

Internally the unix timestamp is used, this does not go "backwards", it is simply converted into a display time by the software, all that will happen is these display times will change as the timezone details change. Posts will remain in order and simply display altered times.

i.e.

10:18pm User1"My Thread"
10:26pm User2"Nice Thread"
11:20pm User3"This thread is cool"

SnapOff Racing
10-31-2009, 11:18 PM
vb stores the posts in GMT -0 correct? But vb also gets the current date and time from the server as well right? So if the time on the server is shifted back an hour then wouldn't the timestamp be reported incorrectly? Like right now if I were to make a post on my forum then the timestamp would be 1257009720 which would translate to Saturday, October 31st 2009, 17:22:00 (GMT -0)

So then if I shift my clock back an hour on my server and then make the same post RIGHT NOW that would then make the timestamp be 1257006120 which would translate into Saturday, October 31st 2009, 16:22:00 (GMT -0)

So yeah I am still lost lol

Dismounted
11-01-2009, 01:46 AM
It doesn't matter. All (*nix based) servers in the world count on Unix timestamps - the amount of seconds since the Unix epoch (January 1 1970, 00:00 UTC). That is the base time. Times for all other timezones are derived from this timestamp.

SnapOff Racing
11-01-2009, 07:13 AM
I get that but what I don't get is if I change the time on my server and roll it back 1 hour, this will cause the time on my forum to get changed as well. So why would it be any different when DST takes effect? I just don't understand how it works. I know how UTC and Unix timestamps work and what they are etc. But it just doesn't make sense about how if I manually change the time on my server and roll it back an hour that this will cause the forum time to change as well which will potentially cause posts to get screwed up. But so why then would that same thing not happen when DST takes effect? DST is essentially doing the same thing as me changing my time manually and rolling it back an hour right?

DeanLag
11-01-2009, 07:35 AM
I have an issue ressembling to this. Everytime my server crashes, (Happened 3 times in the space of 1 week ;-;), the server time is 3h late than it should be. When forum users post something, it shows the post before they even created the thread. Fixing server time doesn't fix the post time.

To fix this issue, I have to manually look for the posts and change the time the post were made.

Dismounted
11-01-2009, 08:40 AM
Again, even though your server changes its timezone to its DST equivalent, the underlying "counter" is still UTC. When vBulletin gets the time from your server, it uses a function called time(). This fetches the timestamp from the server, and Unix timestamps are always seconds since the Unix epoch - no exceptions.

SnapOff Racing
11-01-2009, 06:15 PM
There must be some special internal setting in the OS somewhere then because when I change my time manually on my server, that will then in turn affect the time on the forum. But when the time change hit last night I was watching the time on my server and at 2AM it rolled back to 1AM but the time on my forum stayed the same. So there must be some sorta special internal setting somewhere that monitors this because like I said, I tried testing this out myself MANUALLY at around 11pm I was fooling around trying to change the time myself from 2am to 1am and it was definitely changing the time on my forum as well. Even right now if I were to change the time on my server and roll it back an hour this would cause the time on my forum to roll back an hour as well.

Shit is confusing as hell lol

Dismounted
11-02-2009, 03:18 AM
The server will automatically change through timezones (DST and non-DST) when it is programmed to. When you manually change the time - you are not changing the timezone, but the actual base time. Again, Unix timestamps are always taken as UTC, so timezone changes do not affect this.

SnapOff Racing
11-02-2009, 07:09 PM
Ahhhhh OK that makes PERFECT sense then :up:

Paul M
11-02-2009, 08:13 PM
vb stores the posts in GMT -0 correct?
Nope, like I said, it stores them as the unix timestamp. This is translated into a display time by vb, depending on your timezone settings. The unix timestamp always moves forwards, whatever your timezone does.

SnapOff Racing
11-03-2009, 12:18 AM
Yes I know but what I was saying is that VB stores the TIMESTAMPS as GMT-0 which is equal to UTC

Dismounted
11-03-2009, 01:21 AM
Unix timestamps are always seconds since January 1 1970, 00:00 UTC. Anything other than that is not a Unix timestamp.

Xanlamin
11-09-2009, 04:39 AM
It will not mess up the post order cause the post still have an ID number assigned to them, so you may see a post before time was set back with a time stamp of 1:02AM and a post number of #500 and no one post till DST has taken affect and the next post is post #501 with a time stamp of 1:01AM, I have been running forums for the past 12 years and this has always been the case and it has not messed up a single time.

and time is set back at 2am not midnight, so at DST when the clock is at 1:59am then another minute goes by it will be 1:00am

Marco van Herwaarden
11-09-2009, 07:49 AM
Posts are not ordered by post-id but by timestamp.

Xanlamin
11-09-2009, 11:55 AM
IF that was the case then in my example post #501 would be rearranged with post #500 after DST went into affect. cause post #501 was at 1:01am and post #500 was at 1:02am.