Twitter time, Facebook time

With regards to the discrepancy between the Twitter and Facebook timestamps highlighted in my previous posting, I was actually a little uncomfortable in proclaiming that “Twitter was right and Facebook was wrong” because, frankly speaking, I didn’t know for certain. The evidence was what lawyers would probably call “circumstantial”. To say that Twitter wouldn’t be so stupid as to move their time backward when the US switched to DST doesn’t actually prove that they didn’t do such a thing.

So, I took another look.

Many people would know that what is diplayed on their web browsers is  encoded in a language called HTML. The browser that I use, Mozilla Firefox, has a neat tool that can show the HTML code for any portion of text shown on the browser. Just highlight said portion of text, right click and select “View Selection Source” from the drop-down menu. So, I tried doing this on the timestamp for the message Anwar tweeted which Twitter said was at 11.39pm and Facebook said was at 10.40pm, February 21st.

For Twitter, this is what I got:
Twitter HTML source
The interesting portion here is not the text “11:39 PM Feb 21st”, but the attribute “data-time” which has a value of 1298302774000. This is the actual timestamp of the tweet and it is not affected by DST. It is encoded in a format used by most computers which is called “Unix Time” or “Epoch Time”. What it is is the number of milliseconds since the computing “Epoch”, i.e. midnight January 1st, 1970 (UTC  or GMT). To convert this time to a format we humans can read, one can go to a website, such as http://www.epochconverter.com (before you try this, you  should make sure that the timezone on your computer is correct). Below is the result of the conversion
Twitter time converted
So, it seems that the time shown on Twitter is, in fact, correct.

For Facebook, the HTML source is:

It seems that  Facebook does not store its timestamp in Unix Time, but in a more readable text format. The attribute “data-date” gives the time of the post at “Mon, 21 Feb 2011 07:40:12 -0800”. Again, this time too would not have been affected by DST because it gives a reference to UTC in “-800”. That means the time shown is 8 hours behind UTC. Given that the Malaysian timezone is UTC +8, to convert this to Malaysian local time one needs to add 16 hours. 07:40:12 + 16 hours gives us 23:40:12, which is consistent with the time shown by Twitter.

So yes, now I can proclaim with confidence that Twitter was right and Facebook was wrong.

Advertisements

20 Responses to “Twitter time, Facebook time”

  1. Pak Tejo Says:

    Excellent analysis, bro.

  2. MiM Says:

    GOOD JOB BRO !!

    • oik65 Says:

      Thank you. And I would like to return the compliment – good to know there are people like you to engage the “other side” in good honest intellectual debate.

  3. lord jijul Says:

    nice job, i believe those PR supporters doesnt know this because all they know just watching porno using computer. hahaha

  4. bomoh khatan Says:

    I first went to Malaysiakini to read Rafizi’s explanation on the 1 hour discrepancy. His explanation is based on a critical assumption that Facebook uses local time. However, he does not offer any way for the readers to verify if that single most crucial assumption is valid. But your explanation — by going straight to the source code itself — is most credible and squashed his arguments fair and square. Kudos and thank you very much.

    ps: This DST issue sure came up at the right time of the year! Looking forward for sunny days ahead.

    • oik65 Says:

      Thanks. I guess he got a little confused… happens to the best of us. Anyway, I take it you’re from somewhere cold?

      • bomoh khatan Says:

        Aww… you’re being too kind to Rafizi. I’ve also read your previous posts. You write well and your thoughts resonate with mine. I look forward to reading your future posts. And yes, I’m writing from freezing Scotland.

      • oik65 Says:

        Actually, I don’t fault him for getting it wrong, as long as mistakes were made honestly and not an attempt to deceive. But he does need to find a little humility. The tone of his press release on this was, well, unbecoming of someone in his position. Hope he learns from this.

  5. eisaemillio Says:

    well done bro !!!……

  6. Ibni Ismail Says:

    Brilliant..

  7. adlinrotu Says:

    crystal clear bro!

  8. mekyam Says:

    tabik spring, oik! :))

  9. tevez87 Says:

    why time zone in facebook changed from -0800 at 21 Feb but today 30 March -0700…looks like facebook was wrong…!

    • oik65 Says:

      Yup, that’d be because of the switch to Daylight Saving Time that happened on March 13th. Looks like Facebook timestamp everything with the local time at where their servers are at (I’m guessing US Pacific timezone). Nothing wrong with that, but its the conversion to our timezone that they got wrong.

  10. darth Says:

    Isn’t it what you see is what you get? The source code represents what you see in the browser. What you get in the source code is the time that has been determined by the twitter/facebook server regardless whether the time is right or wrong, unix time or whatever.

    Of course the twitter time you just converted is correct since it is what the browser got from the server.

    To really determine the exact time, we have to check the Twit request from DSAI device to the server. Only twitter can confirm this. They can check their server log for raw data. Easy. No need to check the facebook because the twitter is automatically feed to it using Selective Tweets application. The time in twitter’s server log is critical!

    You can actually modify the source code on the fly by using the Firebug plugin for firefox. Get it from here https://addons.mozilla.org/en-US/firefox/addon/firebug/. Try it yourself. right click on the twitter message and change the source code.The display in the browser will change as well.

    Thanks

    • oik65 Says:

      Actually, you don’t see these timestamps on your browser. They are most probably used by Javascripts embedded into the HTML (which is how “data-*” attributes are commonly used). The actual text displayed is taken from somewhere else in the same HTML tag. What is wrong with Facebook in this case is that the text and the timestamp don’t tally.

      The Facebook timestamp does tally with that of Twitter, however. The same message was timestamped 15:39:34 GMT on Twitter and 07:40:12 GMT -0800 on Facebook, which, when converted properly to Malaysian time, become 11:39:34pm and 11:40:12pm respectively. For Facebook, one needs to add 16 hours to timestamps from winter and 15 hours to timestamps from summer because of DST. Apparently, what has happened is that they have added 15 hours to all timestamps, hence the discrepancy that everyone is talking about. The problem with Facebook is with the conversion, not the timestamp.

      Of course, you could contact Twitter and ask them for the logs. Do tell me how you get along, as I am genuinely interested to know. I would be very surprised if there was much, if any, difference between the logs and these timestamps though. There is no reason to think that they would log one timestamp and then store a different timestamp in their database. Why would they? Querying the system for the current time takes CPU cycles and when your server is expected to respond to millions of requests in real-time, you can hardly afford to do this unnecessarily. In any case, do you really think that any delay in Twitter would be big enough to give Anwar an alibi?

      If you’re worried that I might have changed the HTML code, may I suggest that you try the steps mentioned in the post yourself?

      • andi Says:

        interesting facts..now darth please proof your point, i just like the discussion really educate me in this area..

  11. wau Says:

    Rafizi Kantoi terkantoi-kantoi daaaa….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: