WordPress.org

Ready to get started?Download WordPress

Forums

WP to Twitter
Time differences issue (14 posts)

  1. dionsis
    Member
    Posted 2 years ago #

    Hi I logged a support ticket but never got a response.

    I am on WP to Twitter Pro

    I am connected and configured, however currently there seems to be a time issue between Twitter and WordPress.

    I am in Dublin
    Current local time is 13:36
    Twitter server time is showing at 12:36

    I assume Twitter has multiple time servers for across the world. What way are you deciding which Twitter server to connect to? Basically how can I tell Twitter to use IRISH time?

    http://wordpress.org/extend/plugins/wp-to-twitter/

  2. Joe Dolson
    Member
    Plugin Author

    Posted 2 years ago #

    Does WP to Twitter work for you? Are you able to post? If so, then this is an irrelevant error. There is no way to change what time Twitter will return; the query is sent against Twitter's API; which is the same server that you will then perform authentication against and post to. If you need to change the time of your server, that has to be done locally.

    The time returned by the WP to Twitter local query is the current Unix timestamp, which is NOT a local time; it is measured as GMT. If your timestamp is returning something other than GMT, then that means that the time on your server is incorrect. A one hour difference frequently means that the server missed a daylight savings time change at some point.

    Regarding your support ticket - can you tell me what web site that was logged from? I have not received a support ticket with this query, but I'll check for it.

  3. dionsis
    Member
    Posted 2 years ago #

    It seems to post, but the scheduling appears to take a good while to post. Sometimes an hour.

    I am in Dublin, which is GMT, but GMT is returning a value of 15:40. The actual time in Dublin is 16:40. This makes no sense.

    Even not stopping the posting, it definitely stops my writers adding their Twitter accounts via their profiles. The time gap is given at the reason it could not connect.

    So there is a problem somewhere, my server time reads as it should, 16:42. Twitter time and subsequently GMT time does not read correctly.

    Site posted from is Goldenplec.com for the support ticket.

  4. Joe Dolson
    Member
    Plugin Author

    Posted 2 years ago #

    First, to the best of my knowledge, Dublin is NOT in GMT, which is the same as Western European Time; it's in Irish Standard Time, and is an hour different.

    I did receive your support request, and answered it - perhaps you don't receive email at the address I replied to? It was the administrative address for your web site. (I won't post it here.)

  5. dionsis
    Member
    Posted 2 years ago #

    admin <at> goldenplec - Yeah I get mails at that. Never received anything.

    OK I've checked, Dublin is not GMT, but I have my server set to GMT +1 and it's still coming out an hour behind.

    Basically I'm very confused as to the time settings.

    My WordPress settings page is set to Dublin it tells me
    UTC time is 2012-08-28 20:25:20
    Local time is 2012-08-28 21:25:20

    My console from root of the server says
    19:25:20
    and that clock is set to GMT+1

    root@server:/home/acuffe# dpkg-reconfigure tzdata
    Current default time zone: 'Etc/GMT-1'
    Local time is now: Tue Aug 28 21:28:42 GMT-1 2012.
    Universal Time is now: Tue Aug 28 20:28:42 UTC 2012.

    root@server:/home/acuffe# dpkg-reconfigure tzdata
    Current default time zone: 'Europe/Dublin'
    Local time is now: Tue Aug 28 21:28:57 IST 2012.
    Universal Time is now: Tue Aug 28 20:28:57 UTC 2012.

    I've just set it to
    Current default time zone: 'Etc/GMT'
    Local time is now: Tue Aug 28 20:30:40 GMT 2012.
    Universal Time is now: Tue Aug 28 20:30:40 UTC 2012.

    This is now the correct time on my local machine.

    When I click into WP to Twitter Pro I get
    Your server time: Tuesday, 28-Aug-12 20:31:29 UTC.
    Twitter's current server time: Tuesday, 28-Aug-12 19:31:29 UTC.

    and Settings->General currently says
    UTC time is 2012-08-28 20:31:21 Local time is 2012-08-28 21:31:21

    I don't know why there is such a wild variance in time, I don't know how to configure it so that everything matches. I want my Twitter time to match my server time, but the time you are giving top of your plugin says both are UTC

    So why are they UTC and can this be the problem?

  6. Joe Dolson
    Member
    Plugin Author

    Posted 2 years ago #

    So, I just did some research, and I'm finding that although time() always returns UTC, PHP apparently always reports it (if formatted using date(), which it is, because a straight timestamp is pretty useless), using a timezone set in PHP. So, it sounds like your timezone in PHP is what's incorrect.

    You can set this in php.ini using the date.timezone setting.

    Documentation: http://php.net/manual/en/datetime.configuration.php

    This is the first I've read about this, so I can't say exactly what you need to do, but this might help.

  7. dionsis
    Member
    Posted 2 years ago #

    I have set the Timezone to Europe\Dublin

    I have restarted Apache

    Time is still an hour apart between your timestamps

  8. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    All things considered, my opinion is that there's a time setting somewhere in your server which is not correct. I don't know what it might be -- I'm not a server administrator, and don't know every level of setting that might be relevant -- but the time testing in WP to Twitter is accurate if the information received is accurate.

  9. dionsis
    Member
    Posted 1 year ago #

    How does your application request server time from Twitter

    Can you show me the command ran to get time so I can try figure this out. My times are all correct here. I need to figure out what you are calling to figure why Twitter time is an hour off

  10. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    Simplified, it's this:

    $response = wp_remote_get( "https://api.twitter.com/1/" );
    $date = date( DATE_COOKIE, strtotime($response['headers']['date']) );
    echo $date;

    There's a variety of other things going on in there as well, but that's the essentials of the time query.

  11. dionsis
    Member
    Posted 1 year ago #

    so your taking back a number of variable back from the account 1 and taking the date data from the header data.

    How does the 1 account know to be on my timezone? Should we not be passing in my account?

  12. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    It doesn't; none of the references are specifying a particular timezone. All times should be handled in UTC. The query to your server is

    time()

    Which returns a Unix timestamp; which is in UTC by definition. If that timestamp does NOT return in UTC, that means that the time is wrong at some level on your server.

  13. dionsis
    Member
    Posted 1 year ago #

    does time not track the length of time to execute a query

    or is it time() in PHP

    I've set my server back to 11pm now. Even though it's midnight here.

    It means I have all my time stuff matches up but if I schedule something for 12 midday it won't post till 1pm. It's rather confusing. But I need my time stamps to match up. When your twitter tool tries to schedule the main account tweet, it is an hour late otherwise.

    it's rather confusing.

  14. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    No, time() simply reports the current UNIX timestamp.

    Is your WordPress timezone correct? If scheduling is a problem, you may need to mesh that timezone.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.