YesNoOk
  1. Welcome!
    EosAlpha BBS is a fork of the popular Simple Machines Forum software. We aim at creating a new forum software, adding several new features and a modern and fresh design on top of the existing SMF code base.

    This software is currently in an early stage of development and this forum acts primarily as a testing platform for the ongoing development.

    Feel free to look around to get an idea about how it feels and looks.
avatar

Feature Relative time stamps (Read 3676 times)

Started by Nightwish, August 01, 2011, 16:14:04
0 Members and 1 Guest are viewing this.
Share this topic:
#1
Relative time stamps |
August 01, 2011, 16:14:04
[center]Relative and auto-refreshing timestamps[/center]

Another popular feature from modern web applications I often miss in forums. Timestamps like "a few minutes ago" are easier to read and recognize than a full time stamp like 2011-05-21, 14:23. By seeing something like a few minutes ago, the user instantly knows that the post is new.

For this software, I've chosen a modern method, using JavaScript on the client's browser to to convert standard timestamps into relative ones.
Creating such relative and auto-refreshing timestamps on the client's side using JavaScript has several advantages:
  • Reduces the server load, particularly PHP execution time. Parsing timestamps into relative representations can be quite expensive and it is an operation that is often needed dozens of times for a single page view (for example, board index, forum index). I've done some tests with a PHP implementation and it was showing a significant impact on certain pages where lots of time stamps must be processed.
  • If done server sided, automatic refresh of these time stamps is not possible
Obviously, it requires JavaScript on the user's browser and if it is not available, the user will see standard time stamps. Also, the feature can be disabled in any user's profile, so it is totally optional.
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
3 Like It 
Last Edit: August 04, 2011, 11:19:54 by Admin
#2
Re: Relative time stamps |
August 10, 2011, 10:25:39
AFAICR, JavaScript is how Facebook and xenForo both implement this. It makes sense, but I never had many FB/XF tabs open in the background, and I don't know if it could impact overall browser performance if, for instance, you have plenty of topic pages open, and you have to update the DOM for dozens of places at a time.

That's the first potential issue.
Now, the other issue is that sometimes, I'll *want* to have the complete date. For instance, if I want to know if someone posted after August 4 because I haven't heard from them, and their last post says "a week ago", I'd really, really rather know what day it was exactly... I guess you could add a title="original date", but usability is not at its best even in these conditions, because you don't usually hover a date that's not shaped like a link. (Heck, might as well wanna use the <time> tag. At least it looks cool ;D)

I can certainly understand the interest of having a shortcut saying "Today" or "Yesterday", like SMF does, but anything vague like "A few minutes ago" (instead of "5 minutes ago") is a deal breaker for me, and even "5 minutes ago" isn't overly exciting when you can just have a look at your taskbar's time and know that it was 5 minutes ago.

Other potential issues: if JS is not enabled, you have to provide for a fallback. And it has to be absolute, not relative, of course. Something like <time datetime="12345">Real time</time> would make sense. $('time').update(this.datetime) or something.

Oh, I just realized your feature is already implemented, and used here, and avoiding the issues I mentioned :lol: I probably should have double-checked before writing this longpost :P
So, what about performance with multiple tabs opened? Is it alright?
__
  Wedge
« Everyone knows rock attained perfection in 1974.
It's a scientific fact. » (Homer Simpson)
1 Like It 
#3
Re: Relative time stamps |
August 10, 2011, 10:53:50
AFAICR, JavaScript is how Facebook and xenForo both implement this. It makes sense, but I never had many FB/XF tabs open in the background, and I don't know if it could impact overall browser performance if, for instance, you have plenty of topic pages open, and you have to update the DOM for dozens of places at a time.
Maybe in IE8 and lower it could be noticeable, but not in a modern browser. The update isn't required more often than once per minute and while I did not do any benchmarks with the code, I don't think it could take longer than a few hundred milliseconds, even for a lot of time stamps. Modern JS engines are insanely fast.. hey, there is even a JavaScript virtual machine that can run a Linux kernel in a browser and the performance isn't exactly bad :)
Quote
Now, the other issue is that sometimes, I'll *want* to have the complete date.
Yes, of course you want, and that's very easy to solve with CSS classes. The JS code that converts time stamps will only look at certain classes, so you can tell the timeformat() function how it should return the time stamp - with or without a CSS class. If it's without, the script will ignore it and you see a full time stamp. That's not yet implemented (right now, all time stamps are converted), but fairly easy to do for the (few) cases where a relative time stamp is not desired.
Quote
For instance, if I want to know if someone posted after August 4 because I haven't heard from them, and their last post says "a week ago", I'd really, really rather know what day it was exactly... I guess you could add a title="original date", but usability is not at its best even in these conditions, because you don't usually hover a date that's not shaped like a link. (Heck, might as well wanna use the <time> tag. At least it looks cool ;D)
Hover the timestamp, there is always a tool tip with the normal formatted time :)

Quote
I can certainly understand the interest of having a shortcut saying "Today" or "Yesterday", like SMF does, but anything vague like "A few minutes ago" (instead of "5 minutes ago") is a deal breaker for me, and even "5 minutes ago" isn't overly exciting when you can just have a look at your taskbar's time and know that it was 5 minutes ago.
The script can be fine-tuned for such things. It's still very basic..
Quote
Other potential issues: if JS is not enabled, you have to provide for a fallback. And it has to be absolute, not relative, of course. Something like <time datetime="12345">Real time</time> would make sense. $('time').update(this.datetime) or something.
No JavaScript - you get normal time stamps..
Quote
So, what about performance with multiple tabs opened? Is it alright?
Dunno, with a couple of open tabs, I don't even see CPU activity in the browser when the tabs are idle. A few animated smileys cause a lot more load and like said, the update happens once per minute.
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
#4
Re: Relative time stamps |
August 10, 2011, 20:13:49
And another note...

It should be fairly easy to disable the dynamic timestamps by implementing a "per user" profile option and switch to traditional time stamp formatting.

Just give them users a choice :)
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
#5
Re: Relative time stamps |
August 11, 2011, 20:19:41
It should be fairly easy to disable the dynamic timestamps by implementing a "per user" profile option and switch to traditional time stamp formatting.
Such an option is now available in the profile (Look and Layout - just where the other time formatting options can be found).
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
#6
Re: Relative time stamps |
June 27, 2012, 22:02:35
I noticed that something I posted a second ago is shown as "about two hours ago". something wrong with timezones? either way it's probably not intended behavior.
#7
Re: Relative time stamps |
June 27, 2012, 22:20:12
I noticed that something I posted a second ago is shown as "about two hours ago". something wrong with timezones? either way it's probably not intended behavior.
Yes, timezone setting in your profile must be correct. The forum is running on UTC, so for central europe, the offset should be 2.
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
#8
Re: Relative time stamps |
June 30, 2012, 19:34:35
Since with relative timestamps a correct timezone offset holds more importance than without, maybe it would be a good idea to use the "auto-detect" feature for a better default at registration?
New #9
Re: Relative time stamps |
July 01, 2012, 03:15:05
Since with relative timestamps a correct timezone offset holds more importance than without, maybe it would be a good idea to use the "auto-detect" feature for a better default at registration?
That's just another item on the (long) todo list. I already have working time zone detection for guests[1], just need to integrate this into the registration process.
 1. based on JavaScript and stored in the $_SESSION array.
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
Last Edit: July 01, 2012, 11:24:08 by Nightwish