[glib] gdatetime: Add g_date_time_get_timezone() accessor
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gdatetime: Add g_date_time_get_timezone() accessor
- Date: Thu, 12 Apr 2018 12:26:05 +0000 (UTC)
commit 9ddd17d304642cd42f5e6a76af5cdadb46399ad0
Author: Philip Withnall <withnall endlessm com>
Date: Wed Apr 11 15:58:23 2018 +0100
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
docs/reference/glib/glib-sections.txt | 1 +
glib/gdatetime.c | 18 ++++++++++++++++++
glib/gdatetime.h | 2 ++
3 files changed, 21 insertions(+)
---
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index 2832983ee..58245049d 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -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
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index ba8503813..0ec01a31e 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -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
diff --git a/glib/gdatetime.h b/glib/gdatetime.h
index 025e452a2..65f9965ac 100644
--- a/glib/gdatetime.h
+++ b/glib/gdatetime.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]