GNOME Bugzilla – Bug 668323
g_date_time_format(): need an equivalent of %X without the seconds
Last modified: 2018-04-12 10:21:49 UTC
In Empathy, we use to use "%H:%M" to display a short version of the time (just the hour and minute). Problem is, this is not localized (it will never use the AM/PM notation) so we switched to %X but now we have the seconds displayed as well. Having an equivalent of %X but not displaying the seconds would solve this.
We've decided to keep the formats understood by g_date_time_format to a subset of C99 strftime - does that have a format that suits your needs ?
Doesn't look like it does. But according to g_date_time_format()'s doc, we also support some GNU extensions (which doesn't implement this either). Should we request a new GNU extension first then?
another possibility might be something like: #define G_DATE_TIME_FORMAT_SHORT_TIME g_dgettext("glib20", "%I:%M %P")
i'm not totally convinced that gdatetime is the right place to be solving this particular issue. consider that the shell runs into it too, solving it in its own way (and bringing user preferences into the mix)
If we agree that's the way to go (see bug #671870) it would be good to have some helper code (in libgnome-desktop?) checking this setting and doing the formating.
I agree with Allison (and with Matthias from bug #671279); GDateTime is not the place for reading the user’s settings. If this is still needed, it should be in something like libgnome-desktop, where it can access the user’s preferences about whether to display seconds. This is quite similar to bug #671279.