[libdazzle: 3/5] docs: dzl-date-time
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle: 3/5] docs: dzl-date-time
- Date: Wed, 19 Dec 2018 21:50:20 +0000 (UTC)
commit 70c452f5a5a4ae6283a4c5fe98aed0aae50fbd57
Author: FlyingPiMonster <flyingpimonster flyingpimonster net>
Date: Mon Dec 17 18:56:02 2018 -0600
docs: dzl-date-time
src/util/dzl-date-time.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/util/dzl-date-time.c b/src/util/dzl-date-time.c
index 9120153..944312f 100644
--- a/src/util/dzl-date-time.c
+++ b/src/util/dzl-date-time.c
@@ -22,12 +22,21 @@
#include "dzl-date-time.h"
+/**
+ * SECTION:dzl-date-time
+ * @title: Date and Time Functions
+ * @short_description: Date/time helper functions
+ *
+ * This section provides a few functions to help with displaying dates and times in an
+ * easily readable way.
+ */
+
/**
* dzl_g_date_time_format_for_display:
* @self: A #GDateTime
*
- * Helper function to "humanize" a #GDateTime into a relative time
- * relationship string.
+ * Helper function to create a human-friendly string describing approximately
+ * how long ago a #GDateTime is.
*
* Returns: (transfer full): A newly allocated string describing the
* date and time imprecisely such as "Yesterday".
@@ -71,6 +80,16 @@ dzl_g_date_time_format_for_display (GDateTime *self)
return g_strdup_printf (ngettext ("About %u year ago", "About %u years ago", years), years);
}
+/**
+ * dzl_g_time_span_to_label:
+ * @span: the span of time
+ *
+ * Creates a string describing the time span in hours, minutes, and seconds.
+ * For example, a time span of three and a half minutes would be "3:30".
+ * 2 days, 3 hours, 6 minutes, and 20 seconds would be "51:06:20".
+ *
+ * Returns: (transfer full): A newly allocated string describing the time span.
+ */
gchar *
dzl_g_time_span_to_label (GTimeSpan span)
{
@@ -95,6 +114,12 @@ dzl_g_time_span_to_label (GTimeSpan span)
hours, minutes, seconds);
}
+/**
+ * dzl_g_time_span_to_label_mapping:
+ *
+ * A #GBindingTransformFunc to transform a time span into a string label using
+ * dzl_g_time_span_to_label().
+ */
gboolean
dzl_g_time_span_to_label_mapping (GBinding *binding,
const GValue *from_value,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]