[glib] datetime: Add get_week_of_year()



commit 64300c0cc44b206db3f4dd206cced56ddda33038
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Aug 26 15:23:13 2010 +0100

    datetime: Add get_week_of_year()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=628029
    
    Based on a patch by: Joseph Pingenot
    
    Signed-off-by: Emmanuele Bassi <ebassi linux intel com>

 docs/reference/glib/glib-sections.txt |   25 +++++++++++++------------
 glib/gdatetime.c                      |   21 +++++++++++++++++++++
 glib/gdatetime.h                      |    1 +
 glib/glib.symbols                     |    1 +
 4 files changed, 36 insertions(+), 12 deletions(-)
---
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index 3fa1d2f..dd9aa35 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -1429,41 +1429,42 @@ g_date_time_ref
 g_date_time_unref
 <SUBSECTION>
 g_date_time_add
+g_date_time_add_years
+g_date_time_add_months
+g_date_time_add_weeks
 g_date_time_add_days
-g_date_time_add_full
 g_date_time_add_hours
-g_date_time_add_milliseconds
 g_date_time_add_minutes
-g_date_time_add_months
 g_date_time_add_seconds
-g_date_time_add_weeks
-g_date_time_add_years
+g_date_time_add_milliseconds
+g_date_time_add_full
 <SUBSECTION>
 g_date_time_difference
 g_date_time_compare
 g_date_time_equal
 g_date_time_hash
 <SUBSECTION>
+g_date_time_get_dmy
+g_date_time_get_year
+g_date_time_get_month
+g_date_time_get_week_of_year
 g_date_time_get_day_of_month
 g_date_time_get_day_of_week
 g_date_time_get_day_of_year
-g_date_time_get_dmy
 g_date_time_get_hour
-g_date_time_get_julian
-g_date_time_get_microsecond
-g_date_time_get_millisecond
 g_date_time_get_minute
-g_date_time_get_month
 g_date_time_get_second
+g_date_time_get_millisecond
+g_date_time_get_microsecond
+g_date_time_get_julian
 g_date_time_get_utc_offset
 g_date_time_get_timezone_name
-g_date_time_get_year
 g_date_time_is_daylight_savings
 g_date_time_is_leap_year
 <SUBSECTION>
 g_date_time_day
-g_date_time_to_local
 g_date_time_to_epoch
+g_date_time_to_local
 g_date_time_to_timeval
 g_date_time_to_utc
 g_date_time_printf
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index 625fd4a..8307cf2 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -2231,3 +2231,24 @@ g_date_time_new_utc_now (void)
 
   return utc;
 }
+
+/**
+ * g_date_time_get_week_of_year:
+ *
+ * Returns the numeric week of the respective year.
+ *
+ * Return value: the week of the year
+ *
+ * Since: 2.26
+ */
+gint
+g_date_time_get_week_of_year (const GDateTime *datetime)
+{
+  gint weeknum;
+
+  g_return_val_if_fail (datetime != NULL, 0);
+
+  g_date_time_get_week_number (datetime, &weeknum, NULL, NULL);
+
+  return weeknum;
+}
diff --git a/glib/gdatetime.h b/glib/gdatetime.h
index 7a052cb..800ba93 100644
--- a/glib/gdatetime.h
+++ b/glib/gdatetime.h
@@ -163,6 +163,7 @@ gint                  g_date_time_get_millisecond        (const GDateTime *datet
 gint                  g_date_time_get_microsecond        (const GDateTime *datetime);
 gint                  g_date_time_get_day_of_week        (const GDateTime *datetime);
 gint                  g_date_time_get_day_of_month       (const GDateTime *datetime);
+gint                  g_date_time_get_week_of_year       (const GDateTime *datetime);
 gint                  g_date_time_get_day_of_year        (const GDateTime *datetime);
 gint                  g_date_time_get_month              (const GDateTime *datetime);
 gint                  g_date_time_get_year               (const GDateTime *datetime);
diff --git a/glib/glib.symbols b/glib/glib.symbols
index 41e133a..09f5e23 100644
--- a/glib/glib.symbols
+++ b/glib/glib.symbols
@@ -353,6 +353,7 @@ g_date_time_get_month
 g_date_time_get_second
 g_date_time_get_timezone_name
 g_date_time_get_utc_offset
+g_date_time_get_week_of_year
 g_date_time_get_year
 g_date_time_hash
 g_date_time_is_daylight_savings



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]