[Telepathy] [empathy] message timestamp format

Nicolo' Chieffo 84yelo3 at gmail.com
Mon Jul 12 14:57:16 PDT 2010


Hello, I'm here to discuss about the possibility to change the
timestamp format of incoming and outgoing messages.
The bug link is here: https://bugzilla.gnome.org/show_bug.cgi?id=623934

Currently in empathy defines in empathy-time.h the default format of
time and date:
#define EMPATHY_TIME_FORMAT_DISPLAY_SHORT "%H:%M"
#define EMPATHY_TIME_FORMAT_DISPLAY_LONG  "%a %d %b %Y"

As you can see, those formats are static and does not depend on the
current locale.
For example in USA %H:%M is not the preferred format, because they use
12 hour plus AM/PM.
The same for the date, which is not "day" "number" "month" "year", but
"day" "month" "number" "year".

Currently the time is generated using strftime which is capable of
handling the preferred locale format using the following combinations:
%X the preferred time format without date (including seconds)
%x the preferred date format without time (expressed using numbers)
%c the complete time format with date and time (expressed in abbreviated names)

EXAMPLES:
%X
   en_US.utf8 = 11:44:26 PM
   it_IT.utf8 = 23:44:26

%x
   en_US.utf8 = 07/12/2010
   it_IT.utf8 = 12/07/2010

%c
   en_US.utf8 = Mon 12 Jul 2010 11:45:39 PM CEST [*]
   it_IT.utf8 = lun 12 lug 2010 23:47:33 CEST

[*] this is actually a bug because it should be Jul 12, and it is
correct using en_US without the utf8 modifier

Actually the best replacements would be
#define EMPATHY_TIME_FORMAT_DISPLAY_SHORT "%X"
#define EMPATHY_TIME_FORMAT_DISPLAY_LONG  "%x"

a) unfortunately %X adds the seconds, which are now hidden
b) I'd choose %x because %c is a little too verbose, and originally
EMPATHY_TIME_FORMAT_DISPLAY_LONG does not contain the time. It is
actually used when searcing for chat logs to display the date of the
conversation. Unfortunately the previous way to show also showed the
day name.

Actually I don't know any other way of following the locale preferred
formats, so these are the only possibilities to choose.

I'd also like to point out an improvement we can make: when displaying
logs, we should automatically append the date to the messages.
I have this opinion because when I open a chat window, some logs
appear automatically (actually 4 or 5, I don't remember). I'd really
think that displaying also the date in the logs (it it's different
than today) would really be a good improvement, and I think it can be
changed without much work.
If you agree I'll try to handle this and propose a patch (I'll can the
work in a few days).

What is your opinion?


More information about the telepathy mailing list