What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

This is not a huge issue (not huge at all), but I first noticed this maybe a couple of weeks ago and it's time I mentioned it. The timestamp commentary on comments is saying minutes when it should be saying seconds.

In the example below, it said 8 mins ago the moment I posted the comment, I then immediately edited it twice, this is what it says:

enter image description here

Note that it would have been a maximum of 60 seconds between when I first posted the question the the second of the edits - certainly nowhere near 9 minutes. I may be a retarded typist (2 edits), but I'm certainly not slow.

share|improve this question
2  
Hmm.. let's see... looks fine to me. Any chance you messed with your computer's time? –  Shadow Wizard Jan 24 '13 at 10:06
    
@ShaWizDowArd Coincidentally my machine's clock is..... 9 minutes fast. Obviously the script does an abs() on the time diff so that a negative time doesn't get shown. Problem solved. Post it as an answer so I can mark it. –  slugster Jan 24 '13 at 10:11
    
If your clock is 9 minutes fast, then the time diff is in fact positive -- comment posting date is 10 o'clock, your clock is 10:09, and thus the comment was posted 9 minutes ago. –  balpha Jan 24 '13 at 10:13
    
@balpha See - I told you I was a retarded typist :) –  slugster Jan 24 '13 at 10:22

1 Answer 1

up vote 3 down vote accepted

No worry dear friends, this is NOT a rip in the space-time continuum.

The HTML for the element containing the "... ago" for comments and posts:

<span title="2013-01-24 10:11:54Z" class="relativetime-clean"> 

Then there is clever jQuery code iterating all elements with that class and then with each:

d = d.substr(0, 10) + "T" + d.substr(11, 10);
d = new Date(d);
d = ((new Date).getTime() - d.getTime()) / 1E3;
var c = Math.floor(d / 86400);
d = isNaN(c) || 0 > c || 31 <= c ? void 0: 0 == c && (2 > d && "just now" || 60 > d && Math.floor(d) + (u ? "s ago": " secs ago") || 120 > d && (u ? "1m ago": "1 min ago") || 3600 > d && Math.floor(d / 60) + (u ? "m ago": " mins ago") || 7200 > d && (u ? "1h ago": "1 hour ago") || 86400 > d && Math.floor(d / 3600) + (u ? "h ago": " hours ago"))

Where d is initially given the value of the span title.

As you see (or can't see if JavaScript is alien to you), the time difference is based on the local machine time, so when that time is off so will be the timestamp displayed.

Don't mess with the Zohan computer time!

share|improve this answer

You must log in to answer this question.

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