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>
This commit is contained in:
Emmanuele Bassi 2010-08-26 15:23:13 +01:00
parent 70ef2e3bf6
commit 64300c0cc4
4 changed files with 39 additions and 15 deletions

View File

@ -1429,41 +1429,42 @@ g_date_time_ref
g_date_time_unref
<SUBSECTION>
g_date_time_add
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_months
g_date_time_add_weeks
g_date_time_add_days
g_date_time_add_hours
g_date_time_add_minutes
g_date_time_add_seconds
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

View File

@ -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;
}

View File

@ -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);

View File

@ -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