gdatetime: Add g_date_time_get_timezone() accessor

This is a trivial method to get the GTimeZone for the GDateTime.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795165
This commit is contained in:
Philip Withnall 2018-04-11 15:58:23 +01:00
parent 4e6dc6f2a7
commit 9ddd17d304
3 changed files with 21 additions and 0 deletions

View File

@ -1743,6 +1743,7 @@ g_date_time_to_timeval
<SUBSECTION>
g_date_time_get_utc_offset
g_date_time_get_timezone
g_date_time_get_timezone_abbreviation
g_date_time_is_daylight_savings

View File

@ -2566,6 +2566,24 @@ g_date_time_get_utc_offset (GDateTime *datetime)
return (gint64) offset * USEC_PER_SECOND;
}
/**
* g_date_time_get_timezone:
* @datetime: a #GDateTime
*
* Get the time zone for this @datetime.
*
* Returns: (transfer none): the time zone
* Since: 2.58
*/
GTimeZone *
g_date_time_get_timezone (GDateTime *datetime)
{
g_return_val_if_fail (datetime != NULL, NULL);
g_assert (datetime->tz != NULL);
return datetime->tz;
}
/**
* g_date_time_get_timezone_abbreviation:
* @datetime: a #GDateTime

View File

@ -244,6 +244,8 @@ gboolean g_date_time_to_timeval (GDateTi
GLIB_AVAILABLE_IN_ALL
GTimeSpan g_date_time_get_utc_offset (GDateTime *datetime);
GLIB_AVAILABLE_IN_2_58
GTimeZone * g_date_time_get_timezone (GDateTime *datetime);
GLIB_AVAILABLE_IN_ALL
const gchar * g_date_time_get_timezone_abbreviation (GDateTime *datetime);
GLIB_AVAILABLE_IN_ALL