Bug 897437 - SMS message timestamps do not display the expected strings....

... r=borja

Rewrote the message container handling function. Now with lots of unit tests
covering lots of edge cases.

This patch also does a very little bit of safe refactoring, still with unit
tests.