Somehow that recent patch to allow to set the date in Wordpress actually made things worse: Now every time I post the same entry that date moves back by 5 hours... The date header is show like this:
Date: 2006-08-04 15:15:54 -0500 and if I post that entry again it changes to:
Date: 2006-08-04 10:15:54 -0500
Wordpress is set to show times as UTC -0500.
Gerd
On 5/8/2006, at 23:01, Gerd Knops wrote:
[...] Wordpress is set to show times as UTC -0500.
WP is buggy. It does very strange things with the time zone offset, so everything but a zero offset is going to cause problems.
I did start a patch, but there was too much I did not understand in their code.
On Aug 5, 2006, at 22:04, Allan Odgaard wrote:
On 5/8/2006, at 23:01, Gerd Knops wrote:
[...] Wordpress is set to show times as UTC -0500.
WP is buggy. It does very strange things with the time zone offset, so everything but a zero offset is going to cause problems.
I did start a patch, but there was too much I did not understand in their code.
Any chance we can revert then to the previous state where the WP date was not touched at all?
On 6/8/2006, at 5:54, Gerd Knops wrote:
[...] Wordpress is set to show times as UTC -0500.
WP is buggy. It does very strange things with the time zone offset, so everything but a zero offset is going to cause problems.
I did start a patch, but there was too much I did not understand in their code.
Any chance we can revert then to the previous state where the WP date was not touched at all?
We should then make a check so that it only applies to WP systems [1], as I expect majority of blog systems can handle dates correctly (the previous behavior was to not send the date at all, due to a bug, which was fixed because a user actually requested this working.)
[1] We might need an environment variable, since a WP system using UTC +0000 (like mine :) ) does work fine with WP.
The patch below fixes the issue for me. It should work fine with all WP blogs that are in the same timezone as the user. Of course it'll break once WP gets fixed, but that doesn't seem to be on the horizon.
Gerd
--- blogging.rb.orig 2006-08-13 23:10:40.000000000 -0500 +++ blogging.rb 2006-08-13 23:50:33.000000000 -0500 @@ -404,6 +404,7 @@ # Convert XMLRPC:DateTime to a regular DateTime object so # that we can show the date using the users local time zone. d = DateTime.civil(*self.post['dateCreated'].to_a) + d+=-DateTime.now.offset if (self.mode == 'wp') doc += d.new_offset(DateTime.now.offset).strftime("Date: %F %T % z") + "\n" if self.post['mt_allow_pings'] && (self.post['mt_allow_pings'] == 1)
On 14/8/2006, at 6:54, Gerd Knops wrote:
The patch below fixes the issue for me. It should work fine with all WP blogs that are in the same timezone as the user. Of course it'll break once WP gets fixed, but that doesn't seem to be on the horizon.
Did you check the WP source? There seems to be a few factors: the TZ of the POST (though we convert to UTC, so that offset is always zero), the TZ of the server, and the TZ configured by the user (for his blog.)
In addition the code which splits the TZ offset into hours and minutes will subtract the hours but add the minutes, but there is no “reverse” of that which fixes this “encoding.” -- so a problem which shows up for people in a TZ which is not a full amount of hours from UTC.
Also, the code receiving the date computes two dates (with potential different TZ offsets) and stores both in the database -- I am not sure what the purpose of having two dates is.
So I would recommend simply not sending a date to WP systems.
As for fixing WP, I talked with io_error on #wordpress. He wasn’t sure why my patches from last year hadn’t been rolled into WP, but was certain that if I did one for the TZ problems, that one would -- and he seemed to have some authority to assign bugs to the other commiters, so it might be worth submitting one. Though I am still not sure why they store two dates in the database.
On Aug 14, 2006, at 1:13 AM, Allan Odgaard wrote:
So I would recommend simply not sending a date to WP systems.
The odd thing is the date is set correct in WP, but the date being returned and displayed in TM will be off. This is also the case if I disable the date sending code in blogging.rb. I only had a passing glance at the WP sources, what a mess!
Gerd