WordPress datetime (was: [TxMt] er)

Allan Odgaard throw-away-1 at macromates.com
Sat Jun 23 21:26:35 UTC 2007


On 23. Jun 2007, at 22:54, Daniel Jalkut wrote:

> [...]
> The time-zone one you're running into is actually the earliest  
> issue of the bunch that I raised, so it's not completely fresh in  
> my memory. But it was motivated by a change in 2.2 that would cause  
> the time zone to be completely omitted from the timestamps. While  
> this is arguably correct by "the letter of the law" for XML-RPC,  
> it's not something that WordPress had ever done before

Not being a WP hacker, so I might be wrong, but the change was not  
the actual TZ info, WP never sent such info.

The change was that now WP interprets all dates sent and received via  
XML-RPC as being in GMT. Previously they would be interpreted as  
server time, GMT offset specified in the admin settings, or GMT,  
depending on various variables which I could never fully grasp (from  
analyzing the code).

For that reason the TM blogging bundle never sent WP any dates unless  
you explicitly asked it to (since dates were not reliable unless you  
ensured everything was in GMT).

> so it threw off the times for posts in at least WordPress, and  
> probably other clients as well.

The only way the change in 2.2 would throw off previously correct  
dates was, if the program which displayed that date knew the server  
time / user settings on the server -- but since that depends on the  
server, the user would have to tell the client about it. So now the  
user just needs to update this info to say the server runs in GMT.  
I.e. I don’t see this breaking old stuff.

> I think the way it worked before 2.2 was to put the actual time  
> zone of the blog into the timestamps. So if you had set your blog  
> up as a -4 hours time zone, it would return dates with "-0400" or  
> something on it.

It did send a time which was the local time of the blog, but it *did  
not* give any TZ info.

> So with the change in 2.2 to represent dates in GMT format, I  
> suggested that at least it should indicate as much so that the date  
> would be unambiguous. I think I suggested using -0000, but since Z  
> worked for me and seemed more satisfactory to Joseph, I had no  
> objection.

Dates were ambiguous prior to the change. I agree though that the Z  
is nice because it clarifies that this date is in GMT, unfortunately  
not all XML-RPC parsers will support it (e.g. not the one in Ruby  
1.8.2), and the XML-RPC specification indicates that the TZ is  
outside the actual XML-RPC transportation layer and should be  
documented by the server/protocol -- in our case that would be the  
MetaWeblog API, which is a worse specification than the XML-RPC spec.  
itself, and of course does not document anything related to time zone.

But the consensus among blogging software does seem to be that dates  
are in GMT (and prior to WP 2.2, WP was the oddball).

> Hope this helps clarify the rationale for the fixes. I'm not sure  
> what Joseph should do at this point, if anything. Unless somebody  
> can say with confidence that they feel -0000 will be more reliable  
> across the most clients than Z is.

The best is really to not send any TZ info as -0000 will still break  
some XML-RPC parsers.




More information about the textmate mailing list