After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668323 - g_date_time_format(): need an equivalent of %X without the seconds
g_date_time_format(): need an equivalent of %X without the seconds
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: datetime
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-01-20 10:15 UTC by Guillaume Desmottes
Modified: 2018-04-12 10:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Guillaume Desmottes 2012-01-20 10:15:40 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.
Comment 1 Matthias Clasen 2012-01-20 23:20:51 UTC
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 ?
Comment 2 Guillaume Desmottes 2012-01-23 09:35:20 UTC
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?
Comment 3 Dan Winship 2012-01-23 14:12:20 UTC
another possibility might be something like:

  #define G_DATE_TIME_FORMAT_SHORT_TIME g_dgettext("glib20", "%I:%M %P")
Comment 4 Allison Karlitskaya (desrt) 2012-01-23 14:14:13 UTC
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)
Comment 5 Guillaume Desmottes 2012-03-12 09:19:39 UTC
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.
Comment 6 Philip Withnall 2018-04-12 10:21:49 UTC
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.