qq99 / echoplexus

Socket.io powered chat, JavaScript REPL, whiteboard, and WebRTC calls
Other
394 stars 53 forks source link

Proper time ago with smart updating #205

Closed qq99 closed 10 years ago

qq99 commented 10 years ago

For the most part, the timestamps on chat messages work pretty well. You don't really notice they're broken until you look at how they're implemented.

However, if you left the window open for a long time, you'd notice that the latest message always display "a few minutes ago" (< this does not seem to be the case!)

Similarly, if you left the window open for a very long time, spanning days, you'd see "22:48:49" but it should really say, "2 days ago"

When you refresh, it gets redrawn properly.

There's gotta be a good way to be smart about redrawing the timestamps without wasting CPU:

  1. channel is in focus
  2. window has become focused
  3. attempt to redraw timestamps
  4. place a lock on redrawing timestamps for some sensible period OR only redraw those of messages that occurred today on a schedule?
qq99 commented 10 years ago

A good example of a long running client: screen shot 2014-02-19 at 6 01 52 pm

I tried to be smart about updating the timeago properly, but apparently, not smart enough!

qq99 commented 10 years ago

Fixed in pgp branch