3

On Stack Overflow, the time shown for answers and comments is incorrect. When the post is just 20 mins old, the comments and answers say that they are 12 hours old. I have seen this mistake in more than one post. What is the problem with the clock / time display?

Please, take a look at that.

16
  • 6
    Do you have an example and a screenshot? Commented Jul 2, 2013 at 16:48
  • 5
    Is your system clock accurate?
    – Matt
    Commented Jul 2, 2013 at 16:50
  • I think all the times are in GMT, so if you're not in that timezone they might look odd.
    – Mansfield
    Commented Jul 2, 2013 at 16:51
  • 2
    What difference does a screen shot make? It just shows the time wrong Commented Jul 2, 2013 at 16:51
  • 1
    @AswinMurugesh A screen shot demonstrates exactly what you're seeing, in case we're seeing something different. Providing a link to a sample question along with the screenshot would be good as well.
    – Mansfield
    Commented Jul 2, 2013 at 16:52
  • This question is posted only 20 mins before Commented Jul 2, 2013 at 16:53
  • 1
    @AswinMurugesh On that question, I see the comment and answer times all between 20 and 40 minutes ago, which is why providing a screenshot would be useful.
    – Mansfield
    Commented Jul 2, 2013 at 16:55
  • @AswinMurugesh: Make sure the clock on your computer is correct. That's the only thing that would make the auto-refreshed times incorrect.
    – animuson StaffMod
    Commented Jul 2, 2013 at 16:55
  • @animuson: my computer clock is correct as per my timezone Commented Jul 2, 2013 at 17:01
  • 2
    Can you show a screenshot?
    – Pekka
    Commented Jul 2, 2013 at 17:03
  • @Pekka웃: can't take screen shot at the moment. And the timings become correct when i refresh the screen Commented Jul 2, 2013 at 17:05
  • @AswinMurugesh: I would triple check that your computer clock is accurate, not just set to the right timezone (timeanddate.com), everything about this hints to it being the cause.
    – Matt
    Commented Jul 2, 2013 at 17:12
  • See also meta.stackoverflow.com/network-login-help -- which has some check for time (in the "Communication with stackauth.com" part).
    – Arjan
    Commented Jul 2, 2013 at 17:43
  • possible duplicate of Indicator changes to "2 hours ago" no matter when it was actually posted
    – Arjan
    Commented Jul 2, 2013 at 17:50
  • 1
    @AswinMurugesh can you see if this is still occuring please? A code change was pushed a while ago. Commented Jul 2, 2013 at 21:57

2 Answers 2

7

All relative times are calculated based on your system clock. If your system clock or timezone is incorrectly configured, then the relative time displayed will be incorrect.

The javascript merely asks your system what the current time is according to the UTC timezone, and your system is returning time values that are 12 hours off.

It sounds as if you have your system configured for the wrong timezone; your desktop clock shows the correct time, but you have your system set to a timezone that differs 12 hours from your actual timezone. Another option is that you have AM and PM swapped.

5
  • Perhaps he switched AM and PM somehow if it's exactly 12 hours?
    – Bart
    Commented Jul 2, 2013 at 17:17
  • Indeed, another good possibility. Commented Jul 2, 2013 at 17:19
  • @Bart: There is no AM PM switching . Commented Jul 2, 2013 at 17:23
  • I kind of recall that the JavaScript actually fethed/fetches the server time... (But surely the problems are client side.)
    – Arjan
    Commented Jul 2, 2013 at 17:42
  • Ah, indeed, the server time is in every page: StackExchange.init({..., "serverTime":1372787069, ..., added for the time in the popup. But that is apparently not used for the "xx seconds ago".
    – Arjan
    Commented Jul 2, 2013 at 17:47
7

We now correct for incorrect system clocks by doing the differential from page load with a server offset in account. Basically we just record the difference between your time and server time when we load the page, then add it to the differential when doing relative date calculations.

Bottom line: when it says "2 minutes ago" and updates past that, it should be accurate.


Let me just say now, if you change your system time after loading a page, yes your times will be off - no we're not going to cover that. If you do it and file a bug report on it we'll figure out appropriate retribution, and it will involve salad forks and eyeballs.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .