[glib/wip/date-time-fixes] tweak GTimeZone and GDateTime API, add docs



commit 5de8387494ae400f106d775966c6b58cf92188d8
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Sep 16 12:41:55 2010 -0400

    tweak GTimeZone and GDateTime API, add docs

 docs/reference/glib/glib-docs.sgml    |    1 +
 docs/reference/glib/glib-sections.txt |   22 +++-
 glib/gdatetime.c                      |   31 ++--
 glib/gdatetime.h                      |    2 +-
 glib/glib.symbols                     |    5 +-
 glib/gtimezone.c                      |  309 +++++++++++++++++++++++++++++++--
 glib/gtimezone.h                      |   25 +++-
 glib/tests/gdatetime.c                |    4 +-
 8 files changed, 357 insertions(+), 42 deletions(-)
---
diff --git a/docs/reference/glib/glib-docs.sgml b/docs/reference/glib/glib-docs.sgml
index 6e9f50f..74cc783 100644
--- a/docs/reference/glib/glib-docs.sgml
+++ b/docs/reference/glib/glib-docs.sgml
@@ -76,6 +76,7 @@ synchronize their operation.
       <xi:include href="xml/checksum.xml" />
       <xi:include href="xml/i18n.xml" />
       <xi:include href="xml/date.xml" />
+      <xi:include href="xml/timezone.xml" />
       <xi:include href="xml/date-time.xml" />
       <xi:include href="xml/random_numbers.xml" />
       <xi:include href="xml/hooks.xml" />
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index 1568c48..0b2a056 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -1408,6 +1408,26 @@ g_date_sunday_weeks_in_year
 </SECTION>
 
 <SECTION>
+<FILE>timezone</FILE>
+<SUBSECTION>
+GTimeZone
+g_time_zone_unref
+g_time_zone_ref
+<SUBSECTION>
+g_time_zone_new
+g_time_zone_new_local
+g_time_zone_new_utc
+<SUBSECTION>
+GTimeType
+g_time_zone_find_interval
+g_time_zone_adjust_time
+<SUBSECTION>
+g_time_zone_get_abbreviation
+g_time_zone_get_offset
+g_time_zone_is_dst
+</SECTION>
+
+<SECTION>
 <FILE>date-time</FILE>
 G_TIME_SPAN_DAY
 G_TIME_SPAN_HOUR
@@ -1457,7 +1477,7 @@ 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_timezone_abbreviation
 g_date_time_is_daylight_savings
 g_date_time_is_leap_year
 <SUBSECTION>
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index fe67e99..1fa9776 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -364,9 +364,9 @@ g_date_time_deal_with_date_change (GDateTime *datetime)
   full_time /= USEC_PER_SECOND;
   full_time -= UNIX_EPOCH_START * SEC_PER_DAY;
 
-  datetime->interval = g_time_zone_find_interval (datetime->tz,
-                                                  &was_dst,
-                                                  &full_time);
+  datetime->interval = g_time_zone_adjust_time (datetime->tz,
+                                                was_dst,
+                                                &full_time);
   full_time += UNIX_EPOCH_START * SEC_PER_DAY;
   full_time *= USEC_PER_SECOND;
   full_time += usec;
@@ -398,7 +398,6 @@ static gboolean
 g_date_time_add_usec (GDateTime *datetime,
                       gint64     usec)
 {
-  GTimeType time_type = G_TIME_TYPE_UNIVERSAL;
   gint64 full_time;
 
   /* This is enough to drive any valid time out of the valid region.
@@ -416,8 +415,8 @@ g_date_time_add_usec (GDateTime *datetime,
 
   full_time -= g_time_zone_get_offset (datetime->tz, datetime->interval);
   datetime->interval = g_time_zone_find_interval (datetime->tz,
-                                                  &time_type,
-                                                  &full_time);
+                                                  G_TIME_TYPE_UNIVERSAL,
+                                                  full_time);
   full_time += g_time_zone_get_offset (datetime->tz, datetime->interval);
 
   full_time += UNIX_EPOCH_START * SEC_PER_DAY;
@@ -450,7 +449,6 @@ g_date_time_change_zone (GDateTime *datetime,
 {
   if (datetime->tz != new_tz)
     {
-      GTimeType time_type = G_TIME_TYPE_UNIVERSAL;
       gint64 full_time;
       gint64 usec;
 
@@ -464,8 +462,8 @@ g_date_time_change_zone (GDateTime *datetime,
       g_time_zone_unref (datetime->tz);
       datetime->tz = g_time_zone_ref (new_tz);
       datetime->interval = g_time_zone_find_interval (datetime->tz,
-                                                      &time_type,
-                                                      &full_time);
+                                                      G_TIME_TYPE_UNIVERSAL,
+                                                      full_time);
       full_time += g_time_zone_get_offset (datetime->tz, datetime->interval);
 
       full_time += UNIX_EPOCH_START * SEC_PER_DAY;
@@ -1425,23 +1423,23 @@ g_date_time_get_utc_offset (const GDateTime *datetime)
 }
 
 /**
- * g_date_time_get_timezone_name:
+ * g_date_time_get_timezone_abbreviation:
  * @datetime: a #GDateTime
  *
- * Retrieves the name of the timezone specified by @datetime, if any.
+ * Retrieves the timezone abbreviation for the date specified by @datetime, if any.
  *
- * Return value: (transfer none): the name of the timezone. The returned
+ * Return value: (transfer none): the timezone abbreviation. The returned
  *   string is owned by the #GDateTime and it should not be modified or
  *   freed
  *
  * Since: 2.26
  */
 G_CONST_RETURN gchar *
-g_date_time_get_timezone_name (const GDateTime *datetime)
+g_date_time_get_timezone_abbreviation (const GDateTime *datetime)
 {
   g_return_val_if_fail (datetime != NULL, NULL);
 
-  return g_time_zone_get_name (datetime->tz, datetime->interval);
+  return g_time_zone_get_abbreviation (datetime->tz, datetime->interval);
 }
 
 /**
@@ -1951,10 +1949,7 @@ g_date_time_format (const GDateTime *datetime,
                     g_string_append (outstr, "+0000");
                   break;
                 case 'Z':
-                  if (datetime->tz != NULL)
-                    g_string_append (outstr, g_date_time_get_timezone_name (datetime));
-                  else
-                    g_string_append (outstr, "UTC");
+                  g_string_append (outstr, g_date_time_get_timezone_abbreviation (datetime));
                   break;
                 case '%':
                   g_string_append_c (outstr, '%');
diff --git a/glib/gdatetime.h b/glib/gdatetime.h
index 471414c..0e276e5 100644
--- a/glib/gdatetime.h
+++ b/glib/gdatetime.h
@@ -172,7 +172,7 @@ void                  g_date_time_get_dmy                (const GDateTime *datet
                                                           gint            *year);
 
 GTimeSpan             g_date_time_get_utc_offset         (const GDateTime *datetime);
-G_CONST_RETURN gchar *g_date_time_get_timezone_name      (const GDateTime *datetime);
+G_CONST_RETURN gchar *g_date_time_get_timezone_abbreviation (const GDateTime *datetime);
 gboolean              g_date_time_is_daylight_savings    (const GDateTime *datetime);
 
 gboolean              g_date_time_is_leap_year           (const GDateTime *datetime);
diff --git a/glib/glib.symbols b/glib/glib.symbols
index 3a30916..a0e0911 100644
--- a/glib/glib.symbols
+++ b/glib/glib.symbols
@@ -350,7 +350,7 @@ g_date_time_get_millisecond
 g_date_time_get_minute
 g_date_time_get_month
 g_date_time_get_second
-g_date_time_get_timezone_name
+g_date_time_get_timezone_abbreviation
 g_date_time_get_utc_offset
 g_date_time_get_week_of_year
 g_date_time_get_year
@@ -381,8 +381,9 @@ g_time_zone_new_local
 g_time_zone_new_utc
 g_time_zone_ref
 g_time_zone_unref
+g_time_zone_adjust_time
 g_time_zone_find_interval
-g_time_zone_get_name
+g_time_zone_get_abbreviation
 g_time_zone_get_offset
 g_time_zone_is_dst
 #endif
diff --git a/glib/gtimezone.c b/glib/gtimezone.c
index 761bf08..8440a30 100644
--- a/glib/gtimezone.c
+++ b/glib/gtimezone.c
@@ -35,6 +35,43 @@
 #include "gthread.h"
 #include "gbuffer.h"
 
+/**
+ * SECTION:timezone
+ * @title: GTimeZone
+ * @short_description: A structure representing a time zone
+ * @see_also: #GDateTime
+ *
+ * #GTimeZone is a structure that represents a time zone, at no
+ * particular point in time.  It is refcounted and immutable.
+ *
+ * A time zone contains a number of intervals.  Each interval has
+ * an abbreviation to describe it, an offet to UTC and a flag indicating
+ * if the daylight savings time is in effect during that interval.  A
+ * time zone always has at least one interval -- interval 0.
+ *
+ * Every UTC time is contained within exactly one interval, but a given
+ * local time may be contained within zero, one or two intervals (due to
+ * incontinuities associated with daylight savings time).
+ *
+ * An interval may refer to a specific period of time (eg: the duration
+ * of daylight savings time during 2010) or it may refer to many periods
+ * of time that share the same properties (eg: all periods of daylight
+ * savings time).  It is also possible (usually for political reasons)
+ * that some properties (like the abbreviation) change between intervals
+ * without other properties changing.
+ *
+ * #GTimeZone is available since GLib 2.26.
+ */
+
+/**
+ * GTimeZone:
+ *
+ * #GDateTime is an opaque structure whose members cannot be accessed
+ * directly.
+ *
+ * Since: 2.26
+ **/
+
 /* zoneinfo file format {{{1 */
 
 /* unaligned */
@@ -114,6 +151,14 @@ g_str_equal0 (gconstpointer a,
   return g_str_equal (a, b);
 }
 
+/**
+ * g_time_zone_unref:
+ * @tz: a #GTimeZone
+ *
+ * Decreases the reference count on @tz.
+ *
+ * Since: 2.26
+ **/
 void
 g_time_zone_unref (GTimeZone *tz)
 {
@@ -134,6 +179,16 @@ g_time_zone_unref (GTimeZone *tz)
     }
 }
 
+/**
+ * g_time_zone_ref:
+ * @tz: a #GTimeZone
+ *
+ * Increases the reference count on @tz.
+ *
+ * Returns: a new reference to @tz.
+ *
+ * Since: 2.26
+ **/
 GTimeZone *
 g_time_zone_ref (GTimeZone *tz)
 {
@@ -242,8 +297,49 @@ zone_for_constant_offset (const gchar *name)
 }
 
 /* Construction {{{1 */
+/**
+ * g_time_zone_new:
+ * @identifier: (allow-none): a timezone identifier
+ *
+ * Creates a #GTimeZone corresponding to @identifier.
+ *
+ * @identifier can either be an RFC3339/ISO 8601 time offset or
+ * something that would pass as a valid value for the
+ * <varname>TZ</varname> environment variable (including %NULL).
+ *
+ * Valid RFC3339 time offsets are <literal>"Z"</literal> (for UTC) or
+ * <literal>"±hh:mm"</literal>.  ISO 8601 additionally specifies
+ * <literal>"±hhmm"</literal> and <literal>"±hh"</literal>.
+ *
+ * The <varname>TZ</varname> environment variable typically corresponds
+ * to the name of a file in the zoneinfo database, but there are many
+ * other possibilities.  Note that those other possibilities are not
+ * currently implemented, but are planned.
+ *
+ * g_time_zone_new_local() calls this function with the value of the
+ * <varname>TZ</varname> environment variable.  This function itself is
+ * independent of the value of <varname>TZ</varname>, but if @identifier
+ * is %NULL then <filename>/etc/localtime</filename> will be consulted
+ * to discover the correct timezone.
+ *
+ * See <ulink
+ * url='http://tools.ietf.org/html/rfc3339#section-5.6'>RFC3339
+ * §5.6</ulink> for a precise definition of valid RFC3339 time offsets
+ * (the <varname>time-offset</varname> expansion) and ISO 8601 for the
+ * full list of valid time offsets.  See <ulink
+ * url='http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html'>The
+ * GNU C Library manual</ulink> for an explanation of the possible
+ * values of the <varname>TZ</varname> environment variable.
+ *
+ * You should release the return value by calling g_time_zone_unref()
+ * when you are done with it.
+ *
+ * Returns: the requested timezone
+ *
+ * Since: 2.26
+ **/
 GTimeZone *
-g_time_zone_new (const gchar *name)
+g_time_zone_new (const gchar *identifier)
 {
   GTimeZone *tz;
 
@@ -252,20 +348,20 @@ g_time_zone_new (const gchar *name)
     time_zones = g_hash_table_new (g_str_hash0,
                                    g_str_equal0);
 
-  tz = g_hash_table_lookup (time_zones, name);
+  tz = g_hash_table_lookup (time_zones, identifier);
   if (tz == NULL)
     {
       tz = g_slice_new0 (GTimeZone);
-      tz->name = g_strdup (name);
+      tz->name = g_strdup (identifier);
       tz->ref_count = 0;
 
-      tz->zoneinfo = zone_for_constant_offset (name);
+      tz->zoneinfo = zone_for_constant_offset (identifier);
 
       if (tz->zoneinfo == NULL)
         {
           gchar *filename;
 
-          if (name != NULL)
+          if (identifier != NULL)
             {
               const gchar *tzdir;
 
@@ -273,7 +369,7 @@ g_time_zone_new (const gchar *name)
               if (tzdir == NULL)
                 tzdir = "/usr/share/zoneinfo";
 
-              filename = g_build_filename (tzdir, name, NULL);
+              filename = g_build_filename (tzdir, identifier, NULL);
             }
           else
             filename = g_strdup ("/etc/localtime");
@@ -324,12 +420,42 @@ g_time_zone_new (const gchar *name)
   return tz;
 }
 
+/**
+ * g_time_zone_new_utc:
+ *
+ * Creates a #GTimeZone corresponding to UTC.
+ *
+ * This is equivalent to calling g_time_zone_new() with a value like
+ * "Z", "UTC", "+00", etc.
+ *
+ * You should release the return value by calling g_time_zone_unref()
+ * when you are done with it.
+ *
+ * Returns: the universal timezone
+ *
+ * Since: 2.26
+ **/
 GTimeZone *
 g_time_zone_new_utc (void)
 {
-  return g_time_zone_new ("");
+  return g_time_zone_new ("UTC");
 }
 
+/**
+ * g_time_zone_new_local:
+ *
+ * Creates a #GTimeZone corresponding to local time.
+ *
+ * This is equivalent to calling g_time_zone_new() with the value of the
+ * "TZ" environment variable (including the possibility of %NULL).
+ *
+ * You should release the return value by calling g_time_zone_unref()
+ * when you are done with it.
+ *
+ * Returns: the local timezone
+ *
+ * Since: 2.26
+ **/
 GTimeZone *
 g_time_zone_new_local (void)
 {
@@ -410,10 +536,47 @@ interval_valid (GTimeZone *tz,
 }
 
 /* g_time_zone_find_interval() {{{1 */
+
+/**
+ * g_time_zone_adjust_time:
+ * @tz: a #GTimeZone
+ * @type: the #GTimeType of @time
+ * @time: a pointer to a number of seconds since January 1, 1970
+ *
+ * Finds an interval within @tz that corresponds to the given @time,
+ * possibly adjusting @time if required to fit into an interval.
+ * The meaning of @time depends on @type.
+ *
+ * This function is similar to g_time_zone_find_interval(), with the
+ * difference that it always succeeds (by making the adjustments
+ * described below).
+ *
+ * In any of the cases where g_time_zone_find_interval() succeeds then
+ * this function returns the same value, without modifying @time.
+ *
+ * In order to succeed, this function treats @type merely as a hint.
+ * The distinction between %G_TIME_TYPE_STANDARD and
+ * %G_TIME_TYPE_DAYLIGHT is ignored except in the case that the given
+ * @time is ambiguous.  In Toronto, for example, 01:30 on November 7th
+ * 2010 occured twice (once inside of daylight savings time and the
+ * next, an hour later, outside of daylight savings time).  In this
+ * case, the different value of @type would result in a different
+ * interval being returned.
+ *
+ * This function may also modify @time in order to deal with
+ * non-existent times.  If the non-existent local @time of 02:30 were
+ * requested on March 13th 2010 in Toronto then this function would
+ * adjust @time to be 03:00 and return the interval containing the
+ * adjusted time.
+ *
+ * Returns: the interval containing @time, never -1
+ *
+ * Since: 2.26
+ **/
 gint
-g_time_zone_find_interval (GTimeZone *tz,
-                           GTimeType *type,
-                           gint64    *time)
+g_time_zone_adjust_time (GTimeZone *tz,
+                         GTimeType  type,
+                         gint64    *time)
 {
   gint i;
 
@@ -428,7 +591,7 @@ g_time_zone_find_interval (GTimeZone *tz,
 
   g_assert (interval_start (tz, i) <= *time && *time <= interval_end (tz, i));
 
-  if (*type != G_TIME_TYPE_UNIVERSAL)
+  if (type != G_TIME_TYPE_UNIVERSAL)
     {
       if (*time < interval_local_start (tz, i))
         /* if time came before the start of this interval... */
@@ -455,7 +618,7 @@ g_time_zone_find_interval (GTimeZone *tz,
             *time = interval_local_start (tz, i);
         }
 
-      else if (interval_isdst (tz, i) != *type)
+      else if (interval_isdst (tz, i) != type)
         /* it's in this interval, but dst flag doesn't match.
          * check neighbours for a better fit. */
         {
@@ -466,17 +629,104 @@ g_time_zone_find_interval (GTimeZone *tz,
                    *time >= interval_local_start (tz, i + 1))
             i++;
         }
+    }
 
-      *type = interval_isdst (tz, i);
+  return i;
+}
+
+/**
+ * g_time_zone_find_interval:
+ * @tz: a #GTimeZone
+ * @type: the #GTimeType of @time
+ * @time: a number of seconds since January 1, 1970
+ *
+ * Finds an the interval within @tz that corresponds to the given @time.
+ * The meaning of @time depends on @type.
+ *
+ * If @type is %G_TIME_TYPE_UNIVERSAL then this function will always
+ * succeed (since universal time is monotonic and continuous).
+ * Otherwise, there are two situations for which this function could
+ * fail.
+ *
+ * First, it's possible to pick a local time that simply does not exist.
+ * In Toronto, for example, 02:00 on March 14th 2010 does not exist (due
+ * to the leap forward to begin daylight savings time).
+ *
+ * Second, it's possible that the given @type was not a match for the
+ * type of time in effect at the given local time (ie:
+ * %G_TIME_TYPE_STANDARD was specified during an interval of daylight
+ * savings time or %G_TIME_TYPE_DAYLIGHT was specified during an
+ * interval of standard time).
+ *
+ * Returns: the interval containing @time, or -1 in case of failure
+ *
+ * Since: 2.26
+ */
+gint
+g_time_zone_find_interval (GTimeZone *tz,
+                           GTimeType  type,
+                           gint64     time)
+{
+  gint i;
+
+  if (tz->zoneinfo == NULL)
+    return 0;
+
+  for (i = 0; i < tz->timecnt; i++)
+    if (time <= interval_end (tz, i))
+      break;
+
+  if (type == G_TIME_TYPE_UNIVERSAL)
+    return i;
+
+  if (time < interval_local_start (tz, i))
+    {
+      if (time > interval_local_end (tz, --i))
+        return -1;
+    }
+
+  else if (time > interval_local_end (tz, i))
+    {
+      if (time < interval_local_start (tz, ++i))
+        return -1;
+    }
+
+  else if (interval_isdst (tz, i) != type)
+    {
+      if (i && time <= interval_local_end (tz, i - 1))
+        i--;
+
+      else if (i < tz->timecnt && time >= interval_local_start (tz, i + 1))
+        i++;
+
+      else
+        return -1;
     }
 
   return i;
 }
 
 /* Public API accessors {{{1 */
+
+/**
+ * g_time_zone_get_abbreviation:
+ * @tz: a #GTimeZone
+ * @interval: an interval within the timezone
+ *
+ * Determines the time zone abbreviation to be used during a particular
+ * @interval of time in the time zone @tz.
+ *
+ * For example, in Toronto this is currently "EST" during the winter
+ * months and "EDT" during the summer months when daylight savings time
+ * is in effect.
+ *
+ * Returns: the time zone abbreviation, which belongs to @tz
+ *
+ * Since: 2.26
+ **/
 const gchar *
-g_time_zone_get_name (GTimeZone *tz,
-                      gint       interval)
+g_time_zone_get_abbreviation (GTimeZone *tz,
+                              gint       interval)
 {
   g_return_val_if_fail (interval_valid (tz, interval), NULL);
 
@@ -486,6 +736,23 @@ g_time_zone_get_name (GTimeZone *tz,
   return tz->abbrs + interval_abbrind (tz, interval);
 }
 
+/**
+ * g_time_zone_get_offset:
+ * @tz: a #GTimeZone
+ * @interval: an interval within the timezone
+ *
+ * Determines the offset to UTC in effect during a particular @interval
+ * of time in the time zone @tz.
+ *
+ * The offset is the number of seconds that you add to UTC time to
+ * arrive at local time for @tz (ie: negative numbers for time zones
+ * west of GMT, positive numbers for east).
+ *
+ * Returns: the number of seconds that should be added to UTC to get the
+ *          local time in @tz
+ *
+ * Since: 2.26
+ **/
 gint32
 g_time_zone_get_offset (GTimeZone *tz,
                         gint       interval)
@@ -498,6 +765,18 @@ g_time_zone_get_offset (GTimeZone *tz,
   return interval_offset (tz, interval);
 }
 
+/**
+ * g_time_zone_is_dst:
+ * @tz: a #GTimeZone
+ * @interval: an interval within the timezone
+ *
+ * Determines if daylight savings time is in effect during a particular
+ * @interval of time in the time zone @tz.
+ *
+ * Returns: %TRUE if daylight savings time is in effect
+ *
+ * Since: 2.26
+ **/
 gboolean
 g_time_zone_is_dst (GTimeZone *tz,
                     gint       interval)
diff --git a/glib/gtimezone.h b/glib/gtimezone.h
index 702ad11..afcb292 100644
--- a/glib/gtimezone.h
+++ b/glib/gtimezone.h
@@ -32,6 +32,21 @@ G_BEGIN_DECLS
 
 typedef struct _GTimeZone GTimeZone;
 
+/**
+ * GTimeType:
+ * @G_TIME_TYPE_STANDARD: the time is in local standard time
+ * @G_TIME_TYPE_DAYLIGHT: the time is in local daylight time
+ * @G_TIME_TYPE_UNIVERSAL: the time is in UTC
+ *
+ * Disambiguates a given time in two ways.
+ *
+ * First, specifies if the given time is in universal or local time.
+ *
+ * Second, if the time is in local time, specifies if it is local
+ * standard time or local daylight time.  This is important for the case
+ * where the same local time occurs twice (during daylight savings time
+ * transitions, for example).
+ */
 typedef enum
 {
   G_TIME_TYPE_STANDARD,
@@ -39,7 +54,7 @@ typedef enum
   G_TIME_TYPE_UNIVERSAL
 } GTimeType;
 
-GTimeZone *             g_time_zone_new                                 (const gchar *name);
+GTimeZone *             g_time_zone_new                                 (const gchar *identifier);
 GTimeZone *             g_time_zone_new_utc                             (void);
 GTimeZone *             g_time_zone_new_local                           (void);
 
@@ -47,10 +62,14 @@ GTimeZone *             g_time_zone_ref                                 (GTimeZo
 void                    g_time_zone_unref                               (GTimeZone   *tz);
 
 gint                    g_time_zone_find_interval                       (GTimeZone   *tz,
-                                                                         GTimeType   *type,
+                                                                         GTimeType    type,
+                                                                         gint64       time);
+
+gint                    g_time_zone_adjust_time                         (GTimeZone   *tz,
+                                                                         GTimeType    type,
                                                                          gint64      *time);
 
-const gchar *           g_time_zone_get_name                            (GTimeZone   *tz,
+const gchar *           g_time_zone_get_abbreviation                    (GTimeZone   *tz,
                                                                          gint         interval);
 gint32                  g_time_zone_get_offset                          (GTimeZone   *tz,
                                                                          gint         interval);
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index c6f3286..4253053 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -444,7 +444,7 @@ test_GDateTime_new_from_timeval (void)
              g_date_time_get_hour (dt),
              g_date_time_get_minute (dt),
              g_date_time_get_second (dt),
-             g_date_time_get_timezone_name (dt));
+             g_date_time_get_timezone_abbreviation (dt));
 
   g_date_time_to_timeval (dt, &tv2);
   g_assert_cmpint (tv.tv_sec, ==, tv2.tv_sec);
@@ -744,7 +744,7 @@ test_GDateTime_new_full (void)
   g_assert_cmpint (8, ==, g_date_time_get_hour (dt));
   g_assert_cmpint (4, ==, g_date_time_get_minute (dt));
   g_assert_cmpint (0, ==, g_date_time_get_second (dt));
-  g_assert_cmpstr ("BRT", ==, g_date_time_get_timezone_name (dt));
+  g_assert_cmpstr ("BRT", ==, g_date_time_get_timezone_abbreviation (dt));
   g_assert (!g_date_time_is_daylight_savings (dt));
   g_date_time_unref (dt);
 }



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