Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-10-31 18:29:42

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: [issue] Daylight Saving

> TheUsability wrote:

> hey mary,

nice to see you going at this!

I’ve got only one drawback: what about people who were too silly to use DST? Like myself, who used GMT+2 instead of GMT+1 & DST before this weekend… That’s why I thought TXP should just write whatever time is used by the poster to the db. Once saved, there should be no change anymore, no matter what other changes you make to your time prefs.

_TU

Agreed. I am in the same time zone as my server, so I just set Textpattern’s time zone once and since then I haven’t had to tamper with Textpattern’s time settings at all. My server’s clock changes itself, so there’s nothing for Textpattern to do.

Whatever is eventually done to solve this problem shouldn’t change the existing behavior—it can be a preference option, but I’d rather not have all of my article timestamps suddenly start changing.

-Kurt


kurt@kurtraschke.com

Offline

#14 2005-10-31 19:48:15

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Re: [issue] Daylight Saving

Kurt,

that’s what’s happening currently – old times get changed.

*

Mary,

you mean I have to change all my old articles? That’s not feasible.

What I’m doing right now is living in the wrong time zone (the pre-populated field is one hour off), so I’m constantly having to change the time. That sucks. What I want to have is a) all my old articles should still have their old time and b) the pre-populated time should be the right one.

_TU

Last edited by TheUsability (2005-10-31 19:48:53)

Offline

#15 2005-10-31 20:44:29

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [issue] Daylight Saving

What do you mean? They won’t be right anyway – they don’t take into account dst when you saved it, it only adds dst when viewing. DST isn’t observed everywhere, and it also is not on the same day(s) every year either, so a mass upgrade script won’t work.

Offline

#16 2005-10-31 22:51:25

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [issue] Daylight Saving

$when = date('Y-m-d h:i:s', gmmktime() + ($is_dst ? 3600 : 0));

This is not correct. DST should not be applied to GMT. This gives me a post time that’s 11 hours out.

There’s one way to get times and dates right, and that’s to store them as plain vanilla GMT, then apply any time zones and DST offsets at display time.

Anyone who wants prove me wrong can submit a patch and a comprehensive set of test data, including cases like date-based URLs, time zone preference changes, and moving data from one server to another in a different time zone.


Alex

Offline

#17 2005-10-31 23:04:40

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [issue] Daylight Saving

> “This is not correct. DST should not be applied to GMT. This gives me a post time that’s 11 hours out.”

How is that? The database stores the gmt adjusted date, you still apply timezone at display time, whether its text or url?

Offline

#18 2005-10-31 23:23:13

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [issue] Daylight Saving

How is that? The database stores the gmt adjusted date, you still apply timezone at display time, whether its text or url?

Try it on a server where your timezone is different to the server’s.

Ignoring that bug: if is_dst is true, a new post won’t show up for an hour, because of the future/past article check.

Also, it’ll fail on border cases, during the dst -> no dst transition.

Trust me: there is nothing simple about time and date calculations. I’ve been through all this before.

Last edited by zem (2005-10-31 23:25:42)


Alex

Offline

#19 2005-10-31 23:28:22

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [issue] Daylight Saving

PS: I took a look at the PEAR Date class. It has some support for DST, but relies on the server TZ environment variable, which doesn’t work on Windows, and causes threading problems on some servers. I also suspect it doesn’t handle transition times correctly.


Alex

Offline

#20 2005-11-01 01:51:27

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [issue] Daylight Saving

Mm, I see. Oh I do ‘trust’ you, you’ve got a heck of a lot more programming experience than I do wasn’t saying it was easy (I’m also not saying any switch should happen just ‘likethat’, either), just speaking it while working it through my brain, ‘cuz I may as well learn at the same time. :)

Damn Benjamin Franklin.

Offline

#21 2005-11-01 04:14:23

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [issue] Daylight Saving

I am investigating some other options for dealing with this. No promises though.


Alex

Offline

#22 2005-11-01 18:18:05

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Re: [issue] Daylight Saving

Well, to get it all straigt: It would be nice if articles that have been saved already wouldn’t change their time when there is timezone / daylight savings changes. The change should only apply to new articles, not the old ones. That’s all I’m saying. If I change into daylight savings, my old articles shouldn’t change with it. Period.

Besides that, TXP should have a method to get times straight itself. But having it not switching time around on old articles at all would be a great step already, since users tend to be able to change the time when they have to. What they can’t do is to change the time of every single old article. That’s just silly.

Thanks,
_TU

Last edited by TheUsability (2005-11-01 18:18:47)

Offline

#23 2005-11-01 21:09:16

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [issue] Daylight Saving

Just to clarify: the times stored in old articles don’t change. The DST offset is added on-the-fly when the time is displayed. No data is lost or modified.


Alex

Offline

#24 2005-11-01 23:03:00

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Re: [issue] Daylight Saving

It seems to me that also the GMT+/-x offset is added on the fly, zem, not only the DST offset.

Secondly, can that offset adding be stripped in some way for old articles? (problem is, though, old articles will appear in just GMT then, right?!)

Last edited by TheUsability (2005-11-01 23:03:56)

Offline

Board footer

Powered by FluxBB