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 649900 - Add a function to return a display friendly representation of a time
Add a function to return a display friendly representation of a time
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 325064 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-05-10 14:39 UTC by Guillaume Desmottes
Modified: 2018-02-16 13:30 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Guillaume Desmottes 2011-05-10 14:39:19 UTC
Empathy [1] and Totem [2] both have such functions, it would be good to have one in Glib.

[1] http://git.gnome.org/browse/empathy/tree/libempathy/empathy-time.c#n87
[2] http://git.gnome.org/browse/totem/tree/src/properties/bacon-video-widget-properties.c#n144
Comment 1 Bastien Nocera 2011-05-10 14:44:13 UTC
I would also expect similar functions to be used in other media players (such as Rhythmbox, Banshee, etc.).
Comment 2 Matthias Clasen 2011-09-05 00:39:39 UTC
*** Bug 325064 has been marked as a duplicate of this bug. ***
Comment 3 Philip Withnall 2018-02-16 13:09:18 UTC
I think there are several possible requests here:
 1) Absolute time formatting (for example, ‘14:05:01 GMT’), which can be done with g_date_time_format().
 2) Relative time formatting (for example, ‘15 hours ago’ or ‘50 seconds ago’).
 3) Duration formatting (the media player case, for example, ‘1 hour, 24 minutes’).

As mentioned in bug #325064, this is a tricky topic for GLib. We had problems sorting out the disk size formatting functions to everyone’s satisfaction. I think, in general, it’s not possible to provide ‘human readable’ string formatting functions which are general enough to be applicable in enough applications, but not too general to be impossible to use.

Media players and chat clients have different requirements, for example. Media players want to show the time remaining in a stream, or the duration of a stream, and are concerned with small numbers of seconds. Chat clients typically deal with relative times in the past, and don’t care about accuracy to the number of seconds.

I think those are good reasons to keep formatting functions like this in the applications themselves. For the case of media applications, GStreamer might be able to provide something suitable for use by several applications. I don’t think GLib is the right place for this, though.

⇒ WONTFIX
Comment 4 Bastien Nocera 2018-02-16 13:30:31 UTC
(In reply to Philip Withnall from comment #3)
>  3) Duration formatting (the media player case, for example, ‘1 hour, 24
> minutes’).

We'd format that way for display in properties, but not in the media player itself. I filed bug 679850 against GStreamer a long time ago for that purpose though, which is a better place to have media player specific functionality.