I seem to have found the fix for this, and another tweak I make to Twitter Tools to use it, since sometimes my digest would post at the correct time but get the wrong date in the title of the post. Here are the two tweaks I make.
These are both in twitter-tools.php in the function do_digest_post.
1) after the “if (!$start || !$end) return false;” line I added:
//RDW Set default timezone to see if it posts correctly
date_default_timezone_set(‘America/Detroit’);
Now I hardcoded my timezone I am using, so you’ll have to change it to your timezone PHP string. Ideally this would pick up the timezone set for WordPress, but I didn’t take time to figure out how to do that. What happens is that when the date function is used, if it can’t find a timezone setting to convert the date/time to a local time, it uses GMT.
2) This fix is for when the date in the digest post title would be a day off as well. Which would happen when the post would get added to the system the day after, even though the post time and correct tweets would be in the post.
A little farther down in the function, there is a line that says:
‘post_title’ => $wpdb->escape(sprintf($title, date(‘Y-m-d’))),
I changed this to:
‘post_title’ => $wpdb->escape(sprintf($title, date(‘Y-m-d’, $end))),
basically adding the $end to the date function, so that it uses the end date of the digest time frame instead of the current date.
I incorporated this change into my twitter-tools.php (changing the time zone to “America/Denver”), and my Twitter digest last night worked perfectly. Thanks, Rich.
(I copied the whole of the above in here in case the forum post goes away.)
Now let’s hope the fix gets incorporated into future versions of Twitter Tools, so I don’t have to recreate it each time there’s an update.
Now, will this also apply to the similar problem I’ve been having with Digest Post for Google Reader? When I get a chance, I’ll see.
UPDATE: I added in the date_default_timezone_set line in the digest-post.php, at the top of the post_digest function. That seems to have worked!
We nattered on about tipping, Dr. Laura, the skeptic community “Don’t Be a Dick” controversy, hypocrisy, freedom, and a variety of other stuff. This time we clocked in at 2 hours and 8 minutes, which may be case of at least too much of a good thing (or way too of a mediocre thing). Or maybe not enough of a faboo thing. You decide.
In discussing the recent Dr. Laura contretemps, not to mention lack of dickishness, we did engage in a fair amount of, um, NSFW language. So don’t play this over the speakers at the office, or in the streets where you might scare the horses, or if you fear it might burn your cockle-shelled ears.
The podcast can be directly downloaded to your machine here, or you can click on the little player at the bottom of the screen. It, along with the previous iterations in the series, can always be found in the Podcast tab at the top of the page.
UPDATE: I’m re-listening to the podcast (well, maybe not all tonight), and I’m adding in cross-references and links in the comments.
The last year or so has had me doing a lot more in smaller bits — commentary on Google Reader that get reposted here as Unbl0gged Bits, or Twitter summaries. But I’ve been making an effort to post Real Stuff, too, so I hope folks are enjoying.
As always, thanks to those of you who read here, and even more to everyone for commenting. Onward to (gasp) a decade.
I finally (re)implemented a graphical logo here at DDtB. It’s using the Droid font (which I had and used as a logo in the past, long before I ever had a Droid phone, so don’t read too much into it; sometimes a typeface is just a typeface).
Nothing terribly exciting, I’m sure. Just a post for the record.
So I’m having a couple of odd problems here at the blog …
I have two different widgets that post content here from elsewhere. One is the WordPress “Twitter Tools” plugin, which will post a daily digest of my various Tweets. The other is Digest Post for Google Reader, which generates the Unblogged Bits from my Google Reader shares.
Here’s part of the problem: my blog sits in the Mountain time zone (GMT-7, or GMT-6 during Daylight Saving Time). My blog’s servers sit in Eastern time (GMT-5/4).
It's not quite Irwin Allen class trouble, but ...
For some functions, WordPress pays attention to local time (there’s a setting for it an everything). For some functions, though, it looks at the server time. This sometimes causes a bit of hilarity, e.g., at the beginning of August my Twitter Tools digest would close itself off at 9:30pm MDT (when I told it to), but would queue the post to publish at 11:30pm MDT (because 9:30pm MDT = 11:30pm EDT, where the server is). If I wanted a Twitter digest for the day, that’s as close as I could do it, and any Tweets I made after 9:30 wouldn’t show up until the following night.
Notice I said, “at the beginning of August.” As far as I can tell, as of 7 August, something changed on the server end of things, so that now the server time reflects GMT (or UTC). Which means it’s 6 hours off at the moment here in Denver. So Twitter Tools cuts off the nightly Twitter digest at 9:30pm MDT as instructed, but sets up the post to fire off at 3:00am MDT the following day, 6 hours later, complete with the next day’s date stamp.
This is irksome.
I have an inquiry in at the Twitter Tools support forum to see if there’s a way to fix this (the system should look at the time that WordPress recognizes, not what the server says). I seem to also recall there’s a way to tweak a PHP module to use a particular time zone. And I need to poke on the WordPress site to see if there’s a way recommended there to resolve this.
In the meantime, sorry if it sometimes seems like things have egregiously offset time or datestamps. It’s not my intent. Really. I seem to have come unstuck in time …
The views expressed by me on this weblog are mine alone and do not necessarily reflect the views of my employer, my church, my party, my candidate, my community, my wife, my friends, or, on occasion, myself.
Views expressed by others are, well, theirs. I reserve the right to delete them, but it's usually better to let the marketplace of ideas hold sway, even if some packages are long past their expiry date.