[libgda] Make GdaTime introspectable



commit 45b7a081c6ac1e845a32947a96e09cbb9f31b9c4
Author: Daniel Espinosa <esodan gmail com>
Date:   Fri Sep 29 09:12:45 2017 -0700

    Make GdaTime introspectable
    
    Fixes Bug:
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765775

 libgda-ui/data-entries/gdaui-entry-common-time.c |   26 +-
 libgda/gda-server-operation.c                    |   10 +-
 libgda/gda-statement.c                           |    4 +-
 libgda/gda-util.c                                |   44 ++--
 libgda/gda-value.c                               |  287 ++++++++++++++++++----
 libgda/gda-value.h                               |   59 +++---
 libgda/handlers/gda-handler-time.c               |   84 ++++---
 libgda/sqlite/gda-sqlite-provider.c              |   12 +-
 libgda/sqlite/gda-sqlite-recordset.c             |   11 +-
 libgda/sqlite/virtual/gda-vconnection-hub.c      |    7 +-
 providers/postgres/gda-postgres-provider.c       |    2 +-
 providers/postgres/gda-postgres-recordset.c      |   19 +-
 testing/gda-test-blob.c                          |    1 +
 tests/data-models/check_vcnc.c                   |    4 +-
 tests/test-input-parsers.c                       |  208 ++++++++--------
 tests/test-sql-renderer.c                        |   13 +-
 16 files changed, 500 insertions(+), 291 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c 
b/libgda-ui/data-entries/gdaui-entry-common-time.c
index 2916822..e1c2f49 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -659,17 +659,17 @@ real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value)
                        }
                        else {
                                const GdaTime *gtim;
-                               GdaTime copy;
+                               GdaTime* copy;
                                gtim = gda_value_get_time (value);
-                               mgtim->priv->value_tz = fit_tz (gtim->timezone);
-                               mgtim->priv->value_fraction = gtim->fraction;
+                               mgtim->priv->value_tz = fit_tz (gda_time_get_timezone (gtim));
+                               mgtim->priv->value_fraction = gda_time_get_fraction (gtim);
 
-                               copy = *gtim;
-                               gda_time_change_timezone (&copy, mgtim->priv->displayed_tz);
+                               copy = gda_time_copy (gtim);
+                               gda_time_change_timezone (copy, mgtim->priv->displayed_tz);
 
                                GValue *copy_value;
                                copy_value = g_new0 (GValue, 1);
-                               gda_value_set_time (copy_value, &copy);
+                               gda_value_set_time (copy_value, copy);
 
                                gchar *str;
                                str = gda_data_handler_get_str_from_value (dh, copy_value);
@@ -677,6 +677,7 @@ real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value)
 
                                gdaui_entry_set_text (GDAUI_ENTRY (mgtim->priv->entry), str);
                                g_free (str);
+                               gda_time_free (copy);
                        }
                }
                else 
@@ -750,12 +751,13 @@ real_get_value (GdauiEntryWrapper *mgwrap)
                }
 
                if (value && (G_VALUE_TYPE (value) != GDA_TYPE_NULL)) {
-                       GdaTime *gdatime = g_new (GdaTime, 1);
-                       *gdatime = *(gda_value_get_time (value));
-                       gdatime->timezone = mgtim->priv->displayed_tz;
-                       gda_time_change_timezone (gdatime, mgtim->priv->value_tz);
-                       gda_value_set_time (value, gdatime);
-                       g_free (gdatime);
+                       const GdaTime *gdatime;
+                       gdatime = gda_value_get_time (value);
+                       GdaTime *time_copy = gda_time_copy (gdatime);
+                       gda_time_set_timezone (time_copy, mgtim->priv->displayed_tz);
+                       gda_time_change_timezone (time_copy, mgtim->priv->value_tz);
+                       gda_value_set_time (value, time_copy);
+                       gda_time_free (time_copy);
                }
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
diff --git a/libgda/gda-server-operation.c b/libgda/gda-server-operation.c
index 54c389a..52a4e62 100644
--- a/libgda/gda-server-operation.c
+++ b/libgda/gda-server-operation.c
@@ -2769,11 +2769,11 @@ gda_server_operation_create_table_arg_get_fkey_ref_field_get_type ()
 }
 
 
-       /**
-        * gda_server_operation_create_table_arg_fkey_ref_field_new:
-        *
-        * Returns: a new #GdaServerOperationCreateTableArg
-        */
+/**
+ * gda_server_operation_create_table_arg_fkey_ref_field_new:
+ *
+ * Returns: a new #GdaServerOperationCreateTableArg
+ */
 GdaServerOperationCreateTableArgFKeyRefField*
 gda_server_operation_create_table_arg_fkey_ref_field_new ()
 {
diff --git a/libgda/gda-statement.c b/libgda/gda-statement.c
index efa3cb0..7ca9ff4 100644
--- a/libgda/gda-statement.c
+++ b/libgda/gda-statement.c
@@ -803,10 +803,10 @@ default_render_value (const GValue *value, GdaSqlRenderingContext *context, GErr
                        if (G_VALUE_TYPE (value) == GDA_TYPE_TIME) {
                                GdaTime *nts;
                                nts = (GdaTime*) gda_value_get_time (value);
-                               if (nts && (nts->timezone != GDA_TIMEZONE_INVALID)) {
+                               if (nts && (gda_time_get_timezone (nts) != GDA_TIMEZONE_INVALID)) {
                                        nts = gda_time_copy (nts);
                                        gda_time_change_timezone (nts, 0);
-                                       nts->timezone = GDA_TIMEZONE_INVALID;
+                                       gda_time_set_timezone (nts, GDA_TIMEZONE_INVALID);
                                        GValue v = {0};
                                        g_value_init (&v, GDA_TYPE_TIME);
                                        gda_value_set_time (&v, nts);
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index d3cb3a3..9e3bf09 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -3202,8 +3202,11 @@ _parse_iso8601_time (GdaTime *timegda, const gchar *value, gchar sep, glong time
        unsigned long int tmp;
        const char *endptr;
 
-       memset (timegda, 0, sizeof (GdaTime));
-       timegda->timezone = timezone;
+       gda_time_set_hour (timegda, 0);
+       gda_time_set_minute (timegda, 0);
+       gda_time_set_second (timegda, 0);
+       gda_time_set_timezone (timegda, GDA_TIMEZONE_INVALID);
+       gda_time_set_timezone (timegda, timezone);
 
        if ((*value < '0') || (*value > '9'))
                return FALSE;
@@ -3215,7 +3218,7 @@ _parse_iso8601_time (GdaTime *timegda, const gchar *value, gchar sep, glong time
                if (tmp > 23)
                        return FALSE;
        }
-       timegda->hour = tmp;
+       gda_time_set_hour (timegda, tmp);
        if ((sep && *endptr != sep) || !*endptr)
                return FALSE;
 
@@ -3227,7 +3230,7 @@ _parse_iso8601_time (GdaTime *timegda, const gchar *value, gchar sep, glong time
                if (tmp > 59)
                        return FALSE;
        }
-       timegda->minute = tmp;
+       gda_time_set_minute (timegda, tmp);
        if ((sep && *endptr != sep) || !*endptr)
                return FALSE;
 
@@ -3239,7 +3242,7 @@ _parse_iso8601_time (GdaTime *timegda, const gchar *value, gchar sep, glong time
                if (tmp > 59)
                        return FALSE;
        }
-       timegda->second = tmp;
+       gda_time_set_second (timegda, tmp);
        if (*endptr && (*endptr != '.') && (*endptr != '+') && (*endptr != '-')) {
                *out_endptr = endptr;
                return TRUE; /* end of the parsing */
@@ -3254,7 +3257,7 @@ _parse_iso8601_time (GdaTime *timegda, const gchar *value, gchar sep, glong time
                                return FALSE;
                        tmp = tmp * 10 + *endptr - '0';
                }
-               timegda->fraction = tmp;
+               gda_time_set_fraction (timegda, tmp);
        }
        if ((*endptr == '+') || (*endptr == '-')) {
                gint8 mult = 1;
@@ -3265,29 +3268,29 @@ _parse_iso8601_time (GdaTime *timegda, const gchar *value, gchar sep, glong time
                        if (tmp >= 24)
                                return FALSE;
                }
-               timegda->timezone = tmp * 60 * 60 * mult;
+               gda_time_set_timezone (timegda, tmp * 60 * 60 * mult);
        }
        else if (*endptr) {
                for (; g_ascii_isspace (*endptr); endptr++);
                if (((*endptr == 'G') || (*endptr == 'g')) &&
                    ((endptr[1] == 'M') || (endptr[1] == 'm')) &&
                    ((endptr[2] == 'T') || (endptr[2] == 't')) && !endptr[3]) {
-                       timegda->timezone = 0;
+                       gda_time_set_timezone (timegda, 0);
                        endptr += 3;
                }
                else if (((*endptr == 'U') || (*endptr == 'u')) &&
                         ((endptr[1] == 'T') || (endptr[1] == 't')) &&
                         ((endptr[2] == 'C') || (endptr[2] == 'c')) && !endptr[3]) {
-                       timegda->timezone = 0;
+                       gda_time_set_timezone (timegda, 0);
                        endptr += 3;
                }
                else if (((*endptr == 'T') || (*endptr == 'u')) &&
                         ((endptr[1] == 'U') || (endptr[1] == 'u')) && !endptr[2]) {
-                       timegda->timezone = 0;
+                       gda_time_set_timezone (timegda, 0);
                        endptr += 2;
                }
                else if (((*endptr == 'Z') || (*endptr == 'z')) && !endptr[1]) {
-                       timegda->timezone = 0;
+                       gda_time_set_timezone (timegda, 0);
                        endptr += 1;
                }
                else {
@@ -3300,7 +3303,7 @@ _parse_iso8601_time (GdaTime *timegda, const gchar *value, gchar sep, glong time
                                        return FALSE;
                                }
                                else {
-                                       timegda->timezone = g_time_zone_get_offset (tz, 0);
+                                       gda_time_set_timezone (timegda, g_time_zone_get_offset (tz, 0));
                                        g_time_zone_unref (tz);
                                        for (; *endptr; endptr++);
                                }
@@ -3406,10 +3409,7 @@ gda_parse_formatted_timestamp (GdaTimestamp *timestamp, const gchar *value,
        gboolean retval = TRUE;
        const char *endptr;
        GDate gdate;
-       GdaTime timegda;
-
-       memset (&timegda, 0, sizeof (GdaTime));
-       timegda.timezone = GDA_TIMEZONE_INVALID;
+       GdaTime* timegda = gda_time_new ();
 
        if (!value)
                return FALSE;
@@ -3436,15 +3436,15 @@ gda_parse_formatted_timestamp (GdaTimestamp *timestamp, const gchar *value,
                goto out;
 
        /* time part */
-       if (! _parse_iso8601_time (&timegda, value, ':', GDA_TIMEZONE_INVALID, &endptr) ||
+       if (! _parse_iso8601_time (timegda, value, ':', GDA_TIMEZONE_INVALID, &endptr) ||
            *endptr) 
                retval = FALSE;
  out:
-       gda_timestamp_set_hour (timestamp, timegda.hour);
-       gda_timestamp_set_minute (timestamp, timegda.minute);
-       gda_timestamp_set_second (timestamp, timegda.second);
-       gda_timestamp_set_fraction (timestamp, timegda.fraction);
-       gda_timestamp_set_timezone (timestamp, timegda.timezone);
+       gda_timestamp_set_hour (timestamp, gda_time_get_hour (timegda));
+       gda_timestamp_set_minute (timestamp, gda_time_get_minute (timegda));
+       gda_timestamp_set_second (timestamp, gda_time_get_second (timegda));
+       gda_timestamp_set_fraction (timestamp, gda_time_get_fraction (timegda));
+       gda_timestamp_set_timezone (timestamp, gda_time_get_timezone (timegda));
 
        return retval;
 }
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index 789b81d..d6f2b83 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -209,11 +209,12 @@ set_from_string (GValue *value, const gchar *as_string)
                        g_date_free (gdate);
        }
        else if (type == GDA_TYPE_TIME) {
-               GdaTime timegda;
-               if (gda_parse_iso8601_time (&timegda, as_string)) {
-                       gda_value_set_time (value, &timegda);
+               GdaTime* timegda = gda_time_new ();
+               if (gda_parse_iso8601_time (timegda, as_string)) {
+                       gda_value_set_time (value, timegda);
                        retval = TRUE;
                }
+               gda_time_free (timegda);
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
                GdaTimestamp* timestamp = gda_timestamp_new ();
@@ -1343,14 +1344,14 @@ time_to_string (const GValue *src, GValue *dest)
                GString *string;
                string = g_string_new ("");
                g_string_append_printf (string, "%02u:%02u:%02u",
-                                       gdatime->hour,
-                                       gdatime->minute,
-                                       gdatime->second);
-               if (gdatime->fraction != 0)
-                       g_string_append_printf (string, ".%lu", gdatime->fraction);
+                                       gda_time_get_hour (gdatime),
+                                       gda_time_get_minute (gdatime),
+                                       gda_time_get_second (gdatime));
+               if (gda_time_get_fraction (gdatime) != 0)
+                       g_string_append_printf (string, ".%lu", gda_time_get_fraction (gdatime));
 
-               if (gdatime->timezone != GDA_TIMEZONE_INVALID)
-                       g_string_append_printf (string, "%+02d", (int) gdatime->timezone / 3600);
+               if (gda_time_get_timezone (gdatime) != GDA_TIMEZONE_INVALID)
+                       g_string_append_printf (string, "%+02d", (int) gda_time_get_timezone (gdatime) / 
3600);
 
                g_value_take_string (dest, string->str);
                g_string_free (string, FALSE);
@@ -1374,57 +1375,57 @@ string_to_time (const GValue *src, GValue *dest)
        as_string = g_value_get_string (src);
        if (!as_string)
                return;
-       timegda = g_new0 (GdaTime, 1);
+       timegda = gda_time_new ();
 
        /* hour */
-       timegda->timezone = GDA_TIMEZONE_INVALID;
+       gda_time_set_timezone (timegda, GDA_TIMEZONE_INVALID);
        ptr = as_string;
        if ((*ptr >= '0') && (*ptr <= '9') &&
            (*(ptr+1) >= '0') && (*(ptr+1) <= '9'))
-               timegda->hour = (*ptr - '0') * 10 + *(ptr+1) - '0';
+               gda_time_set_hour (timegda, (*ptr - '0') * 10 + *(ptr+1) - '0');
        else {
-               g_free (timegda);
+               gda_time_free (timegda);
                return;
        }
 
        /* minute */
        ptr += 2;
        if (! *ptr) {
-               g_free (timegda);
+               gda_time_free (timegda);
                return;
        }
        if (*ptr == ':')
                ptr++;
        if ((*ptr >= '0') && (*ptr <= '9') &&
            (*(ptr+1) >= '0') && (*(ptr+1) <= '9'))
-               timegda->minute = (*ptr - '0') * 10 + *(ptr+1) - '0';
+               gda_time_set_minute (timegda, (*ptr - '0') * 10 + *(ptr+1) - '0');
        else{
-               g_free (timegda);
+               gda_time_free (timegda);
                return;
        }
 
        /* second */
        ptr += 2;
-       timegda->second = 0;
+       gda_time_set_second (timegda, 0);
        if (! *ptr) {
-               if ((timegda->hour <= 24) && (timegda->minute <= 60))
+               if ((gda_time_get_hour (timegda) <= 24) && (gda_time_get_minute (timegda) <= 60))
                        gda_value_set_time (dest, timegda);
-               g_free (timegda);
+               gda_time_free (timegda);
                return;
        }
        if (*ptr == ':')
                ptr++;
        if ((*ptr >= '0') && (*ptr <= '9') &&
            (*(ptr+1) >= '0') && (*(ptr+1) <= '9'))
-               timegda->second = (*ptr - '0') * 10 + *(ptr+1) - '0';
+               gda_time_set_second (timegda, (*ptr - '0') * 10 + *(ptr+1) - '0');
 
        /* extra */
        ptr += 2;
        if (! *ptr) {
-               if ((timegda->hour <= 24) && (timegda->minute <= 60) &&
-                   (timegda->second <= 60))
+               if ((gda_time_get_hour (timegda) <= 24) && (gda_time_get_minute (timegda) <= 60) &&
+                   (gda_time_get_second (timegda) <= 60))
                        gda_value_set_time (dest, timegda);
-               g_free (timegda);
+               gda_time_free (timegda);
                return;
        }
 
@@ -1440,20 +1441,36 @@ string_to_time (const GValue *src, GValue *dest)
 
        if ((*ptr == '+') || (*ptr == '-')) {
                glong sign = (*ptr == '+') ? 1 : -1;
-               timegda->timezone = 0;
+               gda_time_set_timezone (timegda, 0);
                while (*ptr && (*ptr >= '0') && (*ptr <= '9')) {
-                       timegda->timezone = timegda->timezone * 10 + sign * ((*ptr) - '0');
+                       gda_time_set_timezone (timegda, gda_time_get_timezone (timegda) * 10 + sign * ((*ptr) 
- '0'));
                        ptr++;
                }
-               timegda->timezone *= 3600;
+               gda_time_set_timezone (timegda, gda_time_get_timezone (timegda) * 3600);
        }
 
        /* checks */
-       if ((timegda->hour <= 24) || (timegda->minute <= 60) || (timegda->second <= 60))
+       if ((gda_time_get_hour (timegda) <= 24) || (gda_time_get_minute (timegda) <= 60) || 
(gda_time_get_second (timegda) <= 60))
                gda_value_set_time (dest, timegda);
-       g_free (timegda);
+       gda_time_free (timegda);
 }
 
+/**
+ * _GdaTime:
+ * @hour: hour representation of the time, as a number between 0 and 23
+ * @minute: minute representation of the time, as a number between 0 and 59
+ * @second: second representation of the time, as a number between 0 and 59
+ * @fraction: fractionnal part of the seconds, in millionth' of second
+ * @timezone: number of seconds added to the GMT timezone
+ */
+struct _GdaTime {
+       gushort hour;
+       gushort minute;
+       gushort second;
+       gulong  fraction;
+       glong   timezone;
+};
+
 GType
 gda_time_get_type(void)
 {
@@ -1474,13 +1491,13 @@ gda_time_get_type(void)
 /**
  * gda_time_copy:
  *
- * Returns: (transfer full):
+ * Returns: (transfer full): a pointer to a new #GdaTime struct
  */
-gpointer
-gda_time_copy (gpointer boxed)
+GdaTime*
+gda_time_copy (const GdaTime* time)
 {
 
-       GdaTime *src = (GdaTime*) boxed;
+       GdaTime *src = (GdaTime*) time;
        GdaTime *copy = NULL;
 
        g_return_val_if_fail (src, NULL);
@@ -1495,13 +1512,199 @@ gda_time_copy (gpointer boxed)
        return copy;
 }
 
+/**
+ * gda_time_free:
+ * @time: a #GdaTime to free
+ *
+ * Since: 6.0
+ */
 void
-gda_time_free (gpointer boxed)
+gda_time_free (GdaTime* boxed)
 {
        g_free (boxed);
 }
 
 /**
+ * gda_value_take_time: (skip)
+ * @value: a #GValue that will store @val.
+ * @time: (transfer full): a #GdaTime structure with the time to be stored in @value.
+ *
+ * Stores @val into @value, but on the contrary to gda_value_set_data(), the @time
+ * argument is not copied, but used as-is and it should be considered owned by @value.
+ */
+void
+gda_value_take_time (GValue *value, GdaTime *time)
+{
+       g_return_if_fail (value);
+       g_return_if_fail (time != NULL);
+
+       l_g_value_unset (value);
+       g_value_init (value, GDA_TYPE_TIME);
+       g_value_take_boxed (value, time);
+}
+
+
+/**
+ * gda_time_new:
+ *
+ * Creates a new #GdaTime structure.
+ *
+ * Returns: (transfer full): a new #GdaTime structure
+ */
+GdaTime*
+gda_time_new (void)
+{
+       return g_new0 (GdaTime, 1);
+}
+
+/**
+ * gda_time_new_from_values:
+ * @hour: hours
+ * @minute: minutes
+ * @second: seconds
+ * @fraction: fraction of seconds
+ * @timezone: timezone used
+ *
+ * Returns: (transfer full): the a new value storing a time
+ */
+GdaTime*
+gda_time_new_from_values (gushort hour, gushort minute, gushort second, gulong fraction, glong timezone)
+{
+       GdaTime* time = g_new0 (GdaTime, 1);
+       time->hour = hour;
+       time->minute = minute;
+       time->second = second;
+       time->fraction = fraction;
+       time->timezone = timezone;
+       return time;
+}
+/**
+ * gda_time_get_hour:
+ * @time: a #GdaTime value to get hours from
+ *
+ * Since: 6.0
+ */
+gushort
+gda_time_get_hour (const GdaTime* time)
+{
+       g_return_val_if_fail (time != NULL, 0);
+       return time->hour;
+}
+/**
+ * gda_time_set_hour:
+ * @time: a #GdaTime value to set hours to
+ * @hour: new hours to set to
+ *
+ * Since: 6.0
+ */
+void
+gda_time_set_hour (GdaTime* time, gushort hour)
+{
+       g_return_if_fail (time != NULL);
+       time->hour = hour;
+}
+/**
+ * gda_time_get_minute:
+ * @time: a #GdaTime value to get minutes from
+ *
+ * Since: 6.0
+ */
+gushort
+gda_time_get_minute (const GdaTime* time)
+{
+       g_return_val_if_fail (time != NULL, 0);
+       return time->minute;
+}
+/**
+ * gda_time_set_minute:
+ * @time: a #GdaTime value to set hours to
+ * @minute: new minutes to set to
+ *
+ * Since: 6.0
+ */
+void
+gda_time_set_minute (GdaTime* time, gushort minute)
+{
+       g_return_if_fail (time != NULL);
+       time->minute = minute;
+}
+/**
+ * gda_time_get_second:
+ * @time: a #GdaTime value to get seconds from
+ *
+ * Since: 6.0
+ */
+gushort
+gda_time_get_second (const GdaTime* time)
+{
+       g_return_val_if_fail (time != NULL, 0);
+       return time->second;
+}
+/**
+ * gda_time_set_second:
+ * @time: a #GdaTime value to set hours to
+ * @second: new seconds to set to
+ *
+ * Since: 6.0
+ */
+void
+gda_time_set_second (GdaTime* time, gushort second)
+{
+       g_return_if_fail (time != NULL);
+       time->second = second;
+}
+/**
+ * gda_time_get_fraction:
+ * @time: a #GdaTime value to get fraction of seconds from
+ *
+ * Since: 6.0
+ */
+gulong
+gda_time_get_fraction (const GdaTime* time)
+{
+       g_return_val_if_fail (time != NULL, 0);
+       return time->fraction;
+}
+/**
+ * gda_time_set_fraction:
+ * @time: a #GdaTime value to set hours to
+ * @fraction: new second fraction to set to.
+ *
+ * Since: 6.0
+ */
+void
+gda_time_set_fraction (GdaTime* time, gulong fraction)
+{
+       g_return_if_fail (time != NULL);
+       time->fraction = fraction;
+}
+/**
+ * gda_time_get_timezone:
+ * @time: a #GdaTime value to get time zone from
+ *
+ * Since: 6.0
+ */
+glong
+gda_time_get_timezone (const GdaTime* time)
+{
+       g_return_val_if_fail (time != NULL, 0);
+       return time->timezone;
+}
+/**
+ * gda_time_set_timezone:
+ * @time: a #GdaTime value to set time zone to
+ * @timezone: new time zone to set to. See #gda_time_change_timezone
+ *
+ * Since: 6.0
+ */
+void
+gda_time_set_timezone (GdaTime* time, glong timezone)
+{
+       g_return_if_fail (time != NULL);
+       time->timezone = timezone;
+}
+
+/**
  * gda_time_valid:
  * @time: a #GdaTime value to check if it is valid
  *
@@ -1803,7 +2006,7 @@ gda_timestamp_change_timezone (GdaTimestamp *ts, glong ntz)
 
 
 gshort
-gda_timestamp_get_year (GdaTimestamp* timestamp)
+gda_timestamp_get_year (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->year;
@@ -1815,7 +2018,7 @@ gda_timestamp_set_year (GdaTimestamp* timestamp, gshort year)
        timestamp->year = year;
 }
 gushort
-gda_timestamp_get_month (GdaTimestamp* timestamp)
+gda_timestamp_get_month (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->month;
@@ -1827,7 +2030,7 @@ gda_timestamp_set_month (GdaTimestamp* timestamp, gushort month)
        timestamp->month = month;
 }
 gushort
-gda_timestamp_get_day (GdaTimestamp* timestamp)
+gda_timestamp_get_day (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->day;
@@ -1839,7 +2042,7 @@ gda_timestamp_set_day (GdaTimestamp* timestamp, gushort day)
        timestamp->day = day;
 }
 gushort
-gda_timestamp_get_hour (GdaTimestamp* timestamp)
+gda_timestamp_get_hour (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->hour;
@@ -1851,7 +2054,7 @@ gda_timestamp_set_hour (GdaTimestamp* timestamp, gushort hour)
        timestamp->hour = hour;
 }
 gushort
-gda_timestamp_get_minute (GdaTimestamp* timestamp)
+gda_timestamp_get_minute (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->minute;
@@ -1863,7 +2066,7 @@ gda_timestamp_set_minute (GdaTimestamp* timestamp, gushort minute)
        timestamp->minute = minute;
 }
 gushort
-gda_timestamp_get_second (GdaTimestamp* timestamp)
+gda_timestamp_get_second (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->second;
@@ -1875,7 +2078,7 @@ gda_timestamp_set_second (GdaTimestamp* timestamp, gushort second)
        timestamp->second = second;
 }
 gulong
-gda_timestamp_get_fraction (GdaTimestamp* timestamp)
+gda_timestamp_get_fraction (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->fraction;
@@ -1887,7 +2090,7 @@ gda_timestamp_set_fraction (GdaTimestamp* timestamp, glong fraction)
        timestamp->fraction = fraction;
 }
 glong
-gda_timestamp_get_timezone (GdaTimestamp* timestamp)
+gda_timestamp_get_timezone (const GdaTimestamp* timestamp)
 {
        g_return_val_if_fail (timestamp != NULL, 0);
        return timestamp->timezone;
diff --git a/libgda/gda-value.h b/libgda/gda-value.h
index 47ea699..6658b17 100644
--- a/libgda/gda-value.h
+++ b/libgda/gda-value.h
@@ -82,22 +82,31 @@ gchar*                            gda_numeric_get_string (const GdaNumeric *nume
 void                              gda_numeric_free (GdaNumeric *numeric);
 
 /**
- * GdaTime:
- * @hour: hour representation of the time, as a number between 0 and 23
- * @minute: minute representation of the time, as a number between 0 and 59
- * @second: second representation of the time, as a number between 0 and 59
- * @fraction: fractionnal part of the seconds, in millionth' of second
- * @timezone: number of seconds added to the GMT timezone
+ * GdaTime: (ref-func gda_time_new) (unref-func gda_time_free) (get-value-func gda_value_get_time) 
(set-value-func gda_value_set_time)
  *
  * Represents a time information.
  */
-typedef struct {
-       gushort hour;
-       gushort minute;
-       gushort second;
-       gulong  fraction;
-       glong   timezone;
-} GdaTime;
+typedef struct _GdaTime GdaTime;
+
+GType                             gda_time_get_type (void) G_GNUC_CONST;
+GdaTime*                          gda_time_new (void);
+GdaTime*                          gda_time_new_from_values (gushort hour, gushort minute, gushort second, 
gulong fraction, glong timezone);
+GdaTime*                          gda_time_copy (const GdaTime* time);
+void                              gda_time_free (GdaTime* time);
+
+gushort                           gda_time_get_hour (const GdaTime* time);
+void                              gda_time_set_hour (GdaTime* time, gushort hour);
+gushort                           gda_time_get_minute (const GdaTime* time);
+void                              gda_time_set_minute (GdaTime* time, gushort minute);
+gushort                           gda_time_get_second (const GdaTime* time);
+void                              gda_time_set_second (GdaTime* time, gushort second);
+gulong                            gda_time_get_fraction (const GdaTime *time);
+void                              gda_time_set_fraction (GdaTime* time, gulong fraction);
+glong                             gda_time_get_timezone (const GdaTime *time);
+void                              gda_time_set_timezone (GdaTime* time, glong timezone);
+
+gboolean                          gda_time_valid (const GdaTime *time);
+void                              gda_time_change_timezone (GdaTime *time, glong ntz);
 
 /**
  * GdaBinary: (ref-func gda_binary_new) (unref-func gda_binary_free) (get-value-func gda_value_get_binary) 
(set-value-func gda_value_set_binary)
@@ -254,32 +263,24 @@ GdaBlob                          *gda_string_to_blob (const gchar *str);
 GType                             gda_null_get_type (void) G_GNUC_CONST;
 GType                             gda_default_get_type (void) G_GNUC_CONST;
 
-
-GType                             gda_time_get_type (void) G_GNUC_CONST;
-gpointer                          gda_time_copy (gpointer boxed);
-void                              gda_time_free (gpointer boxed);
-gboolean                          gda_time_valid (const GdaTime *time);
-void                              gda_time_change_timezone (GdaTime *time, glong ntz);
-
-
 typedef struct _GdaTimestamp GdaTimestamp;
 GType                             gda_timestamp_get_type (void) G_GNUC_CONST;
 GdaTimestamp                     *gda_timestamp_new (void);
-gshort                            gda_timestamp_get_year (GdaTimestamp* timestamp);
+gshort                            gda_timestamp_get_year (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_year (GdaTimestamp* timestamp, gshort year);
-gushort                           gda_timestamp_get_month (GdaTimestamp* timestamp);
+gushort                           gda_timestamp_get_month (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_month (GdaTimestamp* timestamp, gushort month);
-gushort                           gda_timestamp_get_day (GdaTimestamp* timestamp);
+gushort                           gda_timestamp_get_day (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_day (GdaTimestamp* timestamp, gushort day);
-gushort                           gda_timestamp_get_hour (GdaTimestamp* timestamp);
+gushort                           gda_timestamp_get_hour (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_hour (GdaTimestamp* timestamp, gushort hour);
-gushort                           gda_timestamp_get_minute (GdaTimestamp* timestamp);
+gushort                           gda_timestamp_get_minute (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_minute (GdaTimestamp* timestamp, gushort minute);
-gushort                           gda_timestamp_get_second (GdaTimestamp* timestamp);
+gushort                           gda_timestamp_get_second (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_second (GdaTimestamp* timestamp, gushort second);
-gulong                            gda_timestamp_get_fraction (GdaTimestamp* timestamp);
+gulong                            gda_timestamp_get_fraction (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_fraction (GdaTimestamp* timestamp, glong fraction);
-glong                             gda_timestamp_get_timezone (GdaTimestamp* timestamp);
+glong                             gda_timestamp_get_timezone (const GdaTimestamp* timestamp);
 void                              gda_timestamp_set_timezone (GdaTimestamp* timestamp, glong timezone);
 gpointer                          gda_timestamp_copy (gpointer boxed);
 void                              gda_timestamp_free (gpointer boxed);
diff --git a/libgda/handlers/gda-handler-time.c b/libgda/handlers/gda-handler-time.c
index 6d66f97..10a628b 100644
--- a/libgda/handlers/gda-handler-time.c
+++ b/libgda/handlers/gda-handler-time.c
@@ -459,17 +459,17 @@ gda_handler_time_get_no_locale_str_from_value (GdaHandlerTime *dh, const GValue
                g_string_append_c (string, '\'');
                tim = gda_value_get_time ((GValue *) value);
                g_string_append_printf (string, "%02d:%02d:%02d",
-                                       tim->hour,
-                                       tim->minute,
-                                       tim->second);
-               if (tim->timezone != GDA_TIMEZONE_INVALID)
+                                       gda_time_get_hour (tim),
+                                       gda_time_get_minute (tim),
+                                       gda_time_get_second (tim));
+               if (gda_time_get_timezone (tim) != GDA_TIMEZONE_INVALID)
                        g_string_append_printf (string, "%+02d",
-                                               (int) tim->timezone / 3600);
+                                               (int) gda_time_get_timezone (tim) / 3600);
                g_string_append_c (string, '\'');
                retval = g_string_free (string, FALSE);
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
-               GdaTimestamp *gdats;
+               const GdaTimestamp *gdats;
                GDate *vdate;
 
                gdats = gda_value_get_timestamp ((GValue *) value);
@@ -694,17 +694,17 @@ gda_handler_time_get_sql_from_value (GdaDataHandler *iface, const GValue *value)
                tim = gda_value_get_time ((GValue *) value);
                g_string_append_c (string, '\'');
                g_string_append_printf (string, "%02d:%02d:%02d",
-                                       tim->hour,
-                                       tim->minute,
-                                       tim->second);
-               if (tim->timezone != GDA_TIMEZONE_INVALID)
+                                       gda_time_get_hour (tim),
+                                       gda_time_get_minute (tim),
+                                       gda_time_get_second (tim));
+               if (gda_time_get_timezone (tim) != GDA_TIMEZONE_INVALID)
                        g_string_append_printf (string, "%+02d",
-                                               (int) tim->timezone / 3600);
+                                               (int) gda_time_get_timezone (tim) / 3600);
                g_string_append_c (string, '\'');
                retval = g_string_free (string, FALSE);
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
-               GdaTimestamp *gdats;
+               const GdaTimestamp *gdats;
                GDate *vdate;
 
                gdats = gda_value_get_timestamp ((GValue *) value);
@@ -808,7 +808,7 @@ gda_handler_time_get_str_from_value (GdaDataHandler *iface, const GValue *value)
                g_free (str);
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
-               GdaTimestamp *gdats;
+               const GdaTimestamp *gdats;
                GDate *vdate;
 
                gdats = gda_value_get_timestamp ((GValue *) value);
@@ -1014,11 +1014,12 @@ gda_handler_time_get_value_from_locale (GdaDataHandler *iface, const gchar *sql,
                }
        }
        else if (type == GDA_TYPE_TIME) {
-               GdaTime timegda;
-               if (make_time (hdl, &timegda, sql)) {
+               GdaTime* timegda = gda_time_new ();
+               if (make_time (hdl, timegda, sql)) {
                        value = g_value_init (g_new0 (GValue, 1), GDA_TYPE_TIME);
-                       gda_value_set_time (value, &timegda);
+                       gda_value_set_time (value, timegda);
                }
+               gda_time_free (timegda);
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
                GdaTimestamp* timestamp = gda_timestamp_new ();
@@ -1048,9 +1049,9 @@ make_ts (GdaHandlerTime *hdl, const gchar *value, LocaleSetting *locale)
        GDateTime *ts;
        const gchar *end_ptr;
        GDate vdate;
-       GdaTime vtime;
-       memset (&vtime, 0, sizeof (GdaTime));
-       vtime.timezone = GDA_TIMEZONE_INVALID;
+       GdaTime* vtime;
+       vtime = gda_time_new ();
+       gda_time_set_timezone (vtime, GDA_TIMEZONE_INVALID);
 
        gboolean retval;
        retval = make_date (hdl, &vdate, value, locale, &end_ptr);
@@ -1058,26 +1059,27 @@ make_ts (GdaHandlerTime *hdl, const gchar *value, LocaleSetting *locale)
                if (*end_ptr != ' ')
                        retval = FALSE;
                else
-                       retval = make_time (hdl, &vtime, end_ptr + 1);
+                       retval = make_time (hdl, vtime, end_ptr + 1);
        }
        if (!retval)
                return NULL;
 
        GTimeZone *tz;
-       if (vtime.timezone != GDA_TIMEZONE_INVALID) {
+       if (gda_time_get_timezone (vtime) != GDA_TIMEZONE_INVALID) {
                gchar *tzdef;
-               if (vtime.timezone >= 0)
-                       tzdef = g_strdup_printf ("+%02d", (gint) (vtime.timezone / 3600));
+               if (gda_time_get_timezone (vtime) >= 0)
+                       tzdef = g_strdup_printf ("+%02d", (gint) (gda_time_get_timezone (vtime) / 3600));
                else
-                       tzdef = g_strdup_printf ("-%02d", (gint) (- vtime.timezone / 3600));
+                       tzdef = g_strdup_printf ("-%02d", (gint) (- gda_time_get_timezone (vtime) / 3600));
                tz = g_time_zone_new (tzdef);
                g_free (tzdef);
        }
        else
                tz = g_time_zone_new_local ();
        ts = g_date_time_new (tz, vdate.year, vdate.month, vdate.day,
-                             vtime.hour, vtime.minute, (gdouble) vtime.second + vtime.fraction);
+                             gda_time_get_hour (vtime), gda_time_get_minute (vtime), (gdouble) 
gda_time_get_second (vtime) + gda_time_get_fraction (vtime));
        g_time_zone_unref (tz);
+       gda_time_free (vtime);
 
        return ts;
 }
@@ -1092,9 +1094,9 @@ make_timestamp (GdaHandlerTime *hdl, GdaTimestamp *timestamp, const gchar *value
        gboolean retval;
        const gchar *end_ptr;
        GDate vdate;
-       GdaTime vtime;
-       memset (&vtime, 0, sizeof (GdaTime));
-       vtime.timezone = GDA_TIMEZONE_INVALID;
+       GdaTime* vtime;
+       vtime = gda_time_new ();
+       gda_time_set_timezone (vtime, GDA_TIMEZONE_INVALID);
 
        retval = make_date (hdl, &vdate, value, locale, &end_ptr);
        gda_timestamp_set_day (timestamp, vdate.day);
@@ -1105,14 +1107,14 @@ make_timestamp (GdaHandlerTime *hdl, GdaTimestamp *timestamp, const gchar *value
                if (*end_ptr != ' ')
                        retval = FALSE;
                else
-                       retval = make_time (hdl, &vtime, end_ptr + 1);
+                       retval = make_time (hdl, vtime, end_ptr + 1);
        }
 
-       gda_timestamp_set_hour (timestamp, vtime.hour);
-       gda_timestamp_set_minute (timestamp, vtime.minute);
-       gda_timestamp_set_second (timestamp, vtime.second);
-       gda_timestamp_set_fraction (timestamp, vtime.fraction);
-       gda_timestamp_set_timezone (timestamp, vtime.timezone);
+       gda_timestamp_set_hour (timestamp, gda_time_get_hour (vtime));
+       gda_timestamp_set_minute (timestamp, gda_time_get_minute (vtime));
+       gda_timestamp_set_second (timestamp, gda_time_get_second (vtime));
+       gda_timestamp_set_fraction (timestamp, gda_time_get_fraction (vtime));
+       gda_timestamp_set_timezone (timestamp, gda_time_get_timezone (vtime));
 
        /*g_print ("Value #%s# => %d\n", value, retval);*/
 
@@ -1307,14 +1309,16 @@ gda_handler_time_get_sane_init_value (G_GNUC_UNUSED GdaDataHandler *iface, GType
                g_value_take_boxed (value, gdate);
        }
        else if (type == GDA_TYPE_TIME) {
-               GdaTime gtime;
+               GdaTime* gtime;
 
-                gtime.hour = stm->tm_hour;
-               gtime.minute = stm->tm_min;
-               gtime.second = stm->tm_sec;
-               gtime.timezone = GDA_TIMEZONE_INVALID;
+               gtime = gda_time_new ();
+
+                gda_time_set_hour (gtime, stm->tm_hour);
+               gda_time_set_minute (gtime, stm->tm_min);
+               gda_time_set_second (gtime, stm->tm_sec);
+               gda_time_set_timezone (gtime, GDA_TIMEZONE_INVALID);
                value = g_value_init (g_new0 (GValue, 1), GDA_TYPE_TIME);
-               gda_value_set_time (value, &gtime);
+               gda_value_set_time (value, gtime);
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
                GdaTimestamp* gts = gda_timestamp_new ();
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 7cbae76..3dc5d7b 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -3252,7 +3252,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                        gtime = (GdaTime *) gda_value_get_time (value);
 
                        string = g_string_new ("");
-                       if (gtime->timezone != GDA_TIMEZONE_INVALID) {
+                       if (gda_time_get_timezone (gtime) != GDA_TIMEZONE_INVALID) {
                                /* SQLite cant' store timezone information, so if timezone information is
                                 * provided, we do our best and convert it to GMT */
                                gtime = gda_time_copy (gtime);
@@ -3261,11 +3261,11 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                        }
 
                        g_string_append_printf (string, "%02u:%02u:%02u",
-                                               gtime->hour,
-                                               gtime->minute,
-                                               gtime->second);
-                       if (gtime->fraction > 0)
-                               g_string_append_printf (string, ".%lu", gtime->fraction);
+                                               gda_time_get_hour (gtime),
+                                               gda_time_get_minute (gtime),
+                                               gda_time_get_second (gtime));
+                       if (gda_time_get_fraction (gtime) > 0)
+                               g_string_append_printf (string, ".%lu", gda_time_get_fraction (gtime));
 
                        if (tofree)
                                gda_time_free (gtime);
diff --git a/libgda/sqlite/gda-sqlite-recordset.c b/libgda/sqlite/gda-sqlite-recordset.c
index b09d378..002f1bc 100644
--- a/libgda/sqlite/gda-sqlite-recordset.c
+++ b/libgda/sqlite/gda-sqlite-recordset.c
@@ -539,8 +539,8 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
                                                g_value_set_boxed (value, &date);
                                }
                                else if (type == GDA_TYPE_TIME) {
-                                       GdaTime timegda;
-                                       if (!gda_parse_iso8601_time (&timegda, 
+                                       GdaTime* timegda = gda_time_new ();
+                                       if (!gda_parse_iso8601_time (timegda,
                                                                     (gchar *) SQLITE3_CALL 
(sqlite3_column_text) (ps->sqlite_stmt, 
                                                                                                    
real_col))) {
                                                GError *lerror = NULL;
@@ -551,10 +551,11 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
                                                gda_row_invalidate_value_e (prow, value, lerror);
                                        }
                                        else {
-                                               if (timegda.timezone == GDA_TIMEZONE_INVALID)
-                                                       timegda.timezone = 0; /* set to GMT */
-                                               gda_value_set_time (value, &timegda);
+                                               if (gda_time_get_timezone (timegda) == GDA_TIMEZONE_INVALID)
+                                                       gda_time_set_timezone (timegda, 0); /* set to GMT */
+                                               gda_value_set_time (value, timegda);
                                        }
+                                       gda_time_free (timegda);
                                }
                                else if (type == GDA_TYPE_TIMESTAMP) {
                                        GdaTimestamp* timestamp = gda_timestamp_new ();
diff --git a/libgda/sqlite/virtual/gda-vconnection-hub.c b/libgda/sqlite/virtual/gda-vconnection-hub.c
index 7dd182d..a06ef2b 100644
--- a/libgda/sqlite/virtual/gda-vconnection-hub.c
+++ b/libgda/sqlite/virtual/gda-vconnection-hub.c
@@ -683,8 +683,8 @@ create_value_from_sqlite3_gvalue (GType type, GValue *svalue, GError **error)
                if (G_VALUE_TYPE (svalue) != G_TYPE_STRING)
                        allok = FALSE;
                else {
-                       GdaTime timegda;
-                       if (!gda_parse_iso8601_time (&timegda, g_value_get_string (svalue))) {
+                       GdaTime* timegda = gda_time_new ();
+                       if (!gda_parse_iso8601_time (timegda, g_value_get_string (svalue))) {
                                g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
                                             GDA_SERVER_PROVIDER_DATA_ERROR,
                                             _("Invalid time '%s' (time format should be HH:MM:SS[.ms])"),
@@ -692,7 +692,8 @@ create_value_from_sqlite3_gvalue (GType type, GValue *svalue, GError **error)
                                allok = FALSE;
                        }
                        else
-                               gda_value_set_time (value, &timegda);
+                               gda_value_set_time (value, timegda);
+                       gda_time_free (timegda);
                }
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
diff --git a/providers/postgres/gda-postgres-provider.c b/providers/postgres/gda-postgres-provider.c
index cae07be..a682808 100644
--- a/providers/postgres/gda-postgres-provider.c
+++ b/providers/postgres/gda-postgres-provider.c
@@ -2252,7 +2252,7 @@ gda_postgres_provider_statement_execute (GdaServerProvider *provider, GdaConnect
 
                        GdaTime *gdatime;
                        gdatime = (GdaTime*) gda_value_get_time (value);
-                       if (gdatime->timezone != GDA_TIMEZONE_INVALID) {
+                       if (gda_time_get_timezone (gdatime) != GDA_TIMEZONE_INVALID) {
                                /* PostgreSQL does not store timezone information, so if timezone information 
is
                                 * provided, we do our best and convert it to GMT */
                                gdatime = gda_time_copy (gdatime);
diff --git a/providers/postgres/gda-postgres-recordset.c b/providers/postgres/gda-postgres-recordset.c
index a523902..3ab9207 100644
--- a/providers/postgres/gda-postgres-recordset.c
+++ b/providers/postgres/gda-postgres-recordset.c
@@ -589,10 +589,10 @@ static void
 make_point (GdaGeometricPoint *point, const gchar *value)
 {
        value++;
-       gda_geometricpoint_set_x (point, g_ascii_strtod (value, NULL));
+       gda_geometric_point_set_x (point, g_ascii_strtod (value, NULL));
        value = strchr (value, ',');
        value++;
-       gda_geometricpoint_set_y (point, g_ascii_strtod (value, NULL));
+       gda_geometric_point_set_y (point, g_ascii_strtod (value, NULL));
 }
 
 static void
@@ -630,18 +630,19 @@ set_value (GdaConnection *cnc, GdaRow *row, GValue *value, GType type, const gch
                                     "%s", _("Internal error"));
        }
        else if (type == GDA_TYPE_TIME) {
-               GdaTime timegda;
-               if (!gda_parse_iso8601_time (&timegda, thevalue)) {
+               GdaTime* timegda = gda_time_new ();
+               if (!gda_parse_iso8601_time (timegda, thevalue)) {
                        gda_row_invalidate_value (row, value); 
                        g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
                                     GDA_SERVER_PROVIDER_DATA_ERROR,
                                     _("Invalid time '%s' (time format should be HH:MM:SS[.ms])"), thevalue);
                }
                else {
-                       if (timegda.timezone == GDA_TIMEZONE_INVALID)
-                               timegda.timezone = 0; /* set to GMT */
-                       gda_value_set_time (value, &timegda);
+                       if (gda_time_get_timezone (timegda) == GDA_TIMEZONE_INVALID)
+                               gda_time_set_timezone (timegda, 0); /* set to GMT */
+                       gda_value_set_time (value, timegda);
                }
+               gda_time_free (timegda);
        }
        else if (type == G_TYPE_INT64)
                g_value_set_int64 (value, atoll (thevalue));
@@ -667,8 +668,8 @@ set_value (GdaConnection *cnc, GdaRow *row, GValue *value, GType type, const gch
        }
        else if (type == GDA_TYPE_GEOMETRIC_POINT) {
                GdaGeometricPoint* point = gda_geometric_point_new ();
-               make_point (&point, thevalue);
-               gda_value_set_geometric_point (value, &point);
+               make_point (point, thevalue);
+               gda_value_set_geometric_point (value, point);
                gda_geometric_point_free (point);
        }
        else if (type == GDA_TYPE_TIMESTAMP) {
diff --git a/testing/gda-test-blob.c b/testing/gda-test-blob.c
index 2f45ed6..b1842f8 100644
--- a/testing/gda-test-blob.c
+++ b/testing/gda-test-blob.c
@@ -22,6 +22,7 @@
 #include <sql-parser/gda-sql-parser.h>
 #include <glib/gi18n-lib.h>
 #include <string.h>
+#include <libgda/gda-connection-private.h>
 
 /* options */
 gchar *pass = NULL;
diff --git a/tests/data-models/check_vcnc.c b/tests/data-models/check_vcnc.c
index 1518b83..5647c53 100644
--- a/tests/data-models/check_vcnc.c
+++ b/tests/data-models/check_vcnc.c
@@ -591,7 +591,7 @@ check_date (GdaConnection *virtual)
        gda_timestamp_set_second (ts, 56);
        gda_timestamp_set_fraction (ts, 0);
        gda_timestamp_set_timezone (ts, 0);
-       GdaTime atime = {13, 45, 59, 0, 0};
+       GdaTime* atime = gda_time_new_from_values (13, 45, 59, 0, 0);
        GDate *adate;
        GdaDataModel *model;
        GError *error = NULL;
@@ -600,7 +600,7 @@ check_date (GdaConnection *virtual)
        set = gda_set_new_inline (3,
                                  "ts", GDA_TYPE_TIMESTAMP, ts,
                                  "adate", G_TYPE_DATE, adate,
-                                 "atime", GDA_TYPE_TIME, &atime);
+                                 "atime", GDA_TYPE_TIME, atime);
        g_date_free (adate);
 
        assert_run_sql_non_select (virtual, "INSERT INTO out.misc VALUES (##ts::timestamp, "
diff --git a/tests/test-input-parsers.c b/tests/test-input-parsers.c
index ef30b6a..a86941c 100644
--- a/tests/test-input-parsers.c
+++ b/tests/test-input-parsers.c
@@ -122,34 +122,38 @@ test_parse_iso8601_date (void)
 typedef struct {
        gchar   *in_string;
        gboolean exp_retval;
-       GdaTime  exp_time;
+       gushort hour;
+       gushort minute;
+       gushort second;
+       gulong fraction;
+       glong timezone;
 } TestTime;
 
 TestTime timedata[] = {
-       {"11:22:56", TRUE, {11, 22, 56, 0, GDA_TIMEZONE_INVALID}},
-       {"1:22:56", TRUE, {1, 22, 56, 0, GDA_TIMEZONE_INVALID}},
-       {"1:22:60", FALSE, {1, 22, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"1:60:45", FALSE, {1, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"24:23:45", FALSE, {0, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"23:59:59", TRUE, {23, 59, 59, 0, GDA_TIMEZONE_INVALID}},
-       {"0:0:00", TRUE, {0, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12:1:0", TRUE, {12, 1, 0, 0, GDA_TIMEZONE_INVALID}},
-       {" 12:00:00", FALSE, {0, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12 :00:00", FALSE, {12, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12: 00:00", FALSE, {12, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12: 00:00", FALSE, {12, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12:1 :00", FALSE, {12, 1, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12:1:2 ", FALSE, {12, 1, 2, 0, GDA_TIMEZONE_INVALID}},
-       {"12:1:2.", FALSE, {12, 1, 2, 0, GDA_TIMEZONE_INVALID}},
-       {"12:1:2:", FALSE, {12, 1, 2, 0, GDA_TIMEZONE_INVALID}},
-       {"12:1:2.123", TRUE, {12, 1, 2, 123, GDA_TIMEZONE_INVALID}},
-       {"12:1:2-2", TRUE, {12, 1, 2, 0, -2*60*60}},
-       {"12:1:2+11", TRUE, {12, 1, 2, 0, 11*60*60}},
-       {"12:1:2.1234+11", TRUE, {12, 1, 2, 1234, 11*60*60}},
-       {"12:1:2.12345678-3", TRUE, {12, 1, 2, 12345678, -3*60*60}},
-       {"12:1:2.12345678 UTC", TRUE, {12, 1, 2, 12345678, 0}},
-       {"12:1:2.12345678 CET", TRUE, {12, 1, 2, 12345678, 60*60}},
-       {"12:1:2.12345678 INVALID", FALSE, {12, 1, 2, 12345678, GDA_TIMEZONE_INVALID}},
+       {"11:22:56", TRUE, 11, 22, 56, 0, GDA_TIMEZONE_INVALID},
+       {"1:22:56", TRUE, 1, 22, 56, 0, GDA_TIMEZONE_INVALID},
+       {"1:22:60", FALSE, 1, 22, 0, 0, GDA_TIMEZONE_INVALID},
+       {"1:60:45", FALSE, 1, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"24:23:45", FALSE, 0, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"23:59:59", TRUE, 23, 59, 59, 0, GDA_TIMEZONE_INVALID},
+       {"0:0:00", TRUE, 0, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12:1:0", TRUE, 12, 1, 0, 0, GDA_TIMEZONE_INVALID},
+       {" 12:00:00", FALSE, 0, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12 :00:00", FALSE, 12, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12: 00:00", FALSE, 12, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12: 00:00", FALSE, 12, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12:1 :00", FALSE, 12, 1, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12:1:2 ", FALSE, 12, 1, 2, 0, GDA_TIMEZONE_INVALID},
+       {"12:1:2.", FALSE, 12, 1, 2, 0, GDA_TIMEZONE_INVALID},
+       {"12:1:2:", FALSE, 12, 1, 2, 0, GDA_TIMEZONE_INVALID},
+       {"12:1:2.123", TRUE, 12, 1, 2, 123, GDA_TIMEZONE_INVALID},
+       {"12:1:2-2", TRUE, 12, 1, 2, 0, -2*60*60},
+       {"12:1:2+11", TRUE, 12, 1, 2, 0, 11*60*60},
+       {"12:1:2.1234+11", TRUE, 12, 1, 2, 1234, 11*60*60},
+       {"12:1:2.12345678-3", TRUE, 12, 1, 2, 12345678, -3*60*60},
+       {"12:1:2.12345678 UTC", TRUE, 12, 1, 2, 12345678, 0},
+       {"12:1:2.12345678 CET", TRUE, 12, 1, 2, 12345678, 60*60},
+       {"12:1:2.12345678 INVALID", FALSE, 12, 1, 2, 12345678, GDA_TIMEZONE_INVALID},
 };
 
 static gboolean
@@ -159,26 +163,26 @@ test_parse_iso8601_time (void)
 
        for (i = 0; i < sizeof (timedata) / sizeof (TestTime); i++) {
                TestTime td = timedata[i];
-               GdaTime time;
+               GdaTime* time = gda_time_new ();
                /*g_print ("[%s]\n", td.in_string);*/
-               if (gda_parse_iso8601_time (&time, td.in_string) != td.exp_retval) {
+               if (gda_parse_iso8601_time (time, td.in_string) != td.exp_retval) {
                        g_print ("Wrong result for gda_parse_iso8601_time (\"%s\"): got %s\n",
                                 td.in_string, td.exp_retval ? "FALSE" : "TRUE");
                        return FALSE;
                }
-               if ((time.hour != td.exp_time.hour) ||
-                   (time.minute != td.exp_time.minute) ||
-                   (time.second != td.exp_time.second) ||
-                   (time.fraction != td.exp_time.fraction) ||
-                   (time.timezone != td.exp_time.timezone)) {
+               if ((gda_time_get_hour (time) != td.hour) ||
+                   (gda_time_get_minute (time) != td.minute) ||
+                   (gda_time_get_second (time) != td.second) ||
+                   (gda_time_get_fraction (time) != td.fraction) ||
+                   (gda_time_get_timezone (time) != td.timezone)) {
                        g_print ("Wrong result for gda_parse_iso8601_time (\"%s\"):\n"
                                 "   exp: HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n"
                                 "   got: HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n",
-                                td.in_string, 
-                                td.exp_time.hour, td.exp_time.minute, td.exp_time.second,
-                                td.exp_time.fraction, td.exp_time.timezone,
-                                time.hour, time.minute, time.second,
-                                time.fraction, time.timezone);
+                                td.in_string,
+                                td.hour, td.minute, td.second,
+                                td.fraction, td.timezone,
+                                gda_time_get_hour (time), gda_time_get_minute (time), gda_time_get_second 
(time),
+                                gda_time_get_fraction (time), gda_time_get_timezone (time));
                        return FALSE;
                }
        }
@@ -191,7 +195,6 @@ static gboolean
 test_parse_iso8601_timestamp (void)
 {
        guint idate, itime;
-
        for (idate = 0; idate < sizeof (datedata) / sizeof (TestTime); idate++) {
                TestDate td = datedata [idate];
                for (itime = 0; itime < sizeof (timedata) / sizeof (TestTime); itime++) {
@@ -212,19 +215,20 @@ test_parse_iso8601_timestamp (void)
                             ((gda_timestamp_get_year (timestamp) != td.exp_year) ||
                              (gda_timestamp_get_month (timestamp) != td.exp_month) ||
                              (gda_timestamp_get_day (timestamp) != td.exp_day))) &&
-                           (((gda_timestamp_get_hour (timestamp) != tt.exp_time.hour) ||
-                             (gda_timestamp_get_minute (timestamp) != tt.exp_time.minute) ||
-                             (gda_timestamp_get_second (timestamp) != tt.exp_time.second) ||
-                             (gda_timestamp_get_fraction (timestamp) != tt.exp_time.fraction) ||
-                             (gda_timestamp_get_timezone (timestamp) != tt.exp_time.timezone)))) {
+                           (((gda_timestamp_get_hour (timestamp) != tt.hour) ||
+                             (gda_timestamp_get_minute (timestamp) != tt.minute) ||
+                             (gda_timestamp_get_second (timestamp) != tt.second) ||
+                             (gda_timestamp_get_fraction (timestamp) != tt.fraction) ||
+                             (gda_timestamp_get_timezone (timestamp) != tt.timezone)))) {
                                g_print ("Wrong result for gda_parse_iso8601_timestamp (\"%s\"):\n"
                                         "   exp: DD=%d MM=%d YYYY=%d HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n"
                                         "   got: DD=%d MM=%d YYYY=%d HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n",
                                         str, td.exp_day, td.exp_month, td.exp_year,
-                                        tt.exp_time.hour, tt.exp_time.minute, tt.exp_time.second, 
tt.exp_time.fraction, tt.exp_time.timezone,
+                                        tt.hour, tt.minute, tt.second, tt.fraction, tt.timezone,
                                         gda_timestamp_get_year (timestamp), gda_timestamp_get_month 
(timestamp),
                                         gda_timestamp_get_day (timestamp), gda_timestamp_get_hour 
(timestamp), gda_timestamp_get_minute (timestamp),
-                                        gda_timestamp_get_second (timestamp), gda_timestamp_get_fraction 
(timestamp), gda_timestamp_get_timezone (timestamp));
+                                        gda_timestamp_get_second (timestamp), gda_timestamp_get_fraction 
(timestamp),
+                                        gda_timestamp_get_timezone (timestamp));
                                         
                                g_free (str);
                                return FALSE;
@@ -288,27 +292,27 @@ test_date_handler (void)
 }
 
 TestTime timedata2[] = {
-       {"112256", TRUE, {11, 22, 56, 0, GDA_TIMEZONE_INVALID}},
-       {"012256", TRUE, {1, 22, 56, 0, GDA_TIMEZONE_INVALID}},
-       {"012260", FALSE, {1, 22, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"016045", FALSE, {1, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"242345", FALSE, {0, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"235959", TRUE, {23, 59, 59, 0, GDA_TIMEZONE_INVALID}},
-       {"000000", TRUE, {0, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"120100", TRUE, {12, 1, 0, 0, GDA_TIMEZONE_INVALID}},
-       {" 120000", FALSE, {0, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12 0000", FALSE, {12, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12 0000", FALSE, {12, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"12 0000", FALSE, {12, 0, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"1201 00", FALSE, {12, 1, 0, 0, GDA_TIMEZONE_INVALID}},
-       {"120102 ", FALSE, {12, 1, 2, 0, GDA_TIMEZONE_INVALID}},
-       {"120102.", FALSE, {12, 1, 2, 0, GDA_TIMEZONE_INVALID}},
-       {"120102:", FALSE, {12, 1, 2, 0, GDA_TIMEZONE_INVALID}},
-       {"120102.123", TRUE, {12, 1, 2, 123, GDA_TIMEZONE_INVALID}},
-       {"120102-2", TRUE, {12, 1, 2, 0, -2*60*60}},
-       {"120102+11", TRUE, {12, 1, 2, 0, 11*60*60}},
-       {"120102.1234+11", TRUE, {12, 1, 2, 1234, 11*60*60}},
-       {"120102.12345678-3", TRUE, {12, 1, 2, 12345678, -3*60*60}},
+       {"112256", TRUE, 11, 22, 56, 0, GDA_TIMEZONE_INVALID},
+       {"012256", TRUE, 1, 22, 56, 0, GDA_TIMEZONE_INVALID},
+       {"012260", FALSE, 1, 22, 0, 0, GDA_TIMEZONE_INVALID},
+       {"016045", FALSE, 1, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"242345", FALSE, 0, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"235959", TRUE, 23, 59, 59, 0, GDA_TIMEZONE_INVALID},
+       {"000000", TRUE, 0, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"120100", TRUE, 12, 1, 0, 0, GDA_TIMEZONE_INVALID},
+       {" 120000", FALSE, 0, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12 0000", FALSE, 12, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12 0000", FALSE, 12, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"12 0000", FALSE, 12, 0, 0, 0, GDA_TIMEZONE_INVALID},
+       {"1201 00", FALSE, 12, 1, 0, 0, GDA_TIMEZONE_INVALID},
+       {"120102 ", FALSE, 12, 1, 2, 0, GDA_TIMEZONE_INVALID},
+       {"120102.", FALSE, 12, 1, 2, 0, GDA_TIMEZONE_INVALID},
+       {"120102:", FALSE, 12, 1, 2, 0, GDA_TIMEZONE_INVALID},
+       {"120102.123", TRUE, 12, 1, 2, 123, GDA_TIMEZONE_INVALID},
+       {"120102-2", TRUE, 12, 1, 2, 0, -2*60*60},
+       {"120102+11", TRUE, 12, 1, 2, 0, 11*60*60},
+       {"120102.1234+11", TRUE, 12, 1, 2, 1234, 11*60*60},
+       {"120102.12345678-3", TRUE, 12, 1, 2, 12345678, -3*60*60},
 };
 
 static gboolean
@@ -336,26 +340,24 @@ test_time_handler (void)
                if (! td.exp_retval)
                        continue;
                const GdaTime *ptime;
-               GdaTime time;
                ptime = gda_value_get_time (value);
-               time = *ptime;
-               gda_value_free (value);
 
-               if ((time.hour != td.exp_time.hour) ||
-                   (time.minute != td.exp_time.minute) ||
-                   (time.second != td.exp_time.second) ||
-                   (time.fraction != td.exp_time.fraction) ||
-                   (time.timezone != td.exp_time.timezone)) {
+               if ((gda_time_get_hour (ptime) != td.hour) ||
+                   (gda_time_get_minute (ptime) != td.minute) ||
+                   (gda_time_get_second (ptime) != td.second) ||
+                   (gda_time_get_fraction (ptime) != td.fraction) ||
+                   (gda_time_get_timezone (ptime) != td.timezone)) {
                        g_print ("Wrong result for gda_data_handler_get_value_from_str (\"%s\", 
GDA_TYPE_TIME):\n"
                                 "   exp: HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n"
                                 "   got: HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n",
-                                td.in_string, 
-                                td.exp_time.hour, td.exp_time.minute, td.exp_time.second,
-                                td.exp_time.fraction, td.exp_time.timezone,
-                                time.hour, time.minute, time.second,
-                                time.fraction, time.timezone);
+                                td.in_string,
+                                td.hour, td.minute, td.second,
+                                td.fraction, td.timezone,
+                                gda_time_get_hour (ptime), gda_time_get_minute (ptime), gda_time_get_second 
(ptime),
+                                gda_time_get_fraction (ptime), gda_time_get_timezone (ptime));
                        return FALSE;
                }
+               gda_value_free (value);
        }
 
        for (j = 0; j < sizeof (timedata2) / sizeof (TestTime); j++) {
@@ -375,26 +377,24 @@ test_time_handler (void)
                if (! td.exp_retval)
                        continue;
                const GdaTime *ptime;
-               GdaTime time;
                ptime = gda_value_get_time (value);
-               time = *ptime;
-               gda_value_free (value);
 
-               if ((time.hour != td.exp_time.hour) ||
-                   (time.minute != td.exp_time.minute) ||
-                   (time.second != td.exp_time.second) ||
-                   (time.fraction != td.exp_time.fraction) ||
-                   (time.timezone != td.exp_time.timezone)) {
+               if ((gda_time_get_hour (ptime) != td.hour) ||
+                   (gda_time_get_minute (ptime) != td.minute) ||
+                   (gda_time_get_second (ptime) != td.second) ||
+                   (gda_time_get_fraction (ptime) != td.fraction) ||
+                   (gda_time_get_timezone (ptime) != td.timezone)) {
                        g_print ("Wrong result forgda_data_handler_get_value_from_str (\"%s\", 
GDA_TYPE_TIME):\n"
                                 "   exp: HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n"
                                 "   got: HH=%d MM=%d SS=%d FF=%ld TZ=%ld\n",
-                                td.in_string, 
-                                td.exp_time.hour, td.exp_time.minute, td.exp_time.second,
-                                td.exp_time.fraction, td.exp_time.timezone,
-                                time.hour, time.minute, time.second,
-                                time.fraction, time.timezone);
+                                td.in_string,
+                                td.hour, td.minute, td.second,
+                                td.fraction, td.timezone,
+                                gda_time_get_hour (ptime), gda_time_get_minute (ptime), gda_time_get_second 
(ptime),
+                                gda_time_get_fraction (ptime), gda_time_get_timezone (ptime));
                        return FALSE;
                }
+               gda_value_free (value);
        }
 
        g_print ("All %d GdaDataHandler (GDA_TYPE_TIME) parsing tests passed\n", i + j);
@@ -446,16 +446,16 @@ test_timestamp_handler (void)
                              (gda_timestamp_get_month (timestamp) != td.exp_month) ||
                              (gda_timestamp_get_day (timestamp) != td.exp_day))) &&
                            ((tt.exp_retval) &&
-                            ((gda_timestamp_get_hour (timestamp) != tt.exp_time.hour) ||
-                             (gda_timestamp_get_minute (timestamp) != tt.exp_time.minute) ||
-                             (gda_timestamp_get_second (timestamp) != tt.exp_time.second) ||
-                             (gda_timestamp_get_fraction (timestamp) != tt.exp_time.fraction) ||
-                             (gda_timestamp_get_timezone (timestamp) != tt.exp_time.timezone)))) {
+                            ((gda_timestamp_get_hour (timestamp) != tt.hour) ||
+                             (gda_timestamp_get_minute (timestamp) != tt.minute) ||
+                             (gda_timestamp_get_second (timestamp) != tt.second) ||
+                             (gda_timestamp_get_fraction (timestamp) != tt.fraction) ||
+                             (gda_timestamp_get_timezone (timestamp) != tt.timezone)))) {
                                g_print ("Wrong result for gda_data_handler_get_value_from_str (\"%s\", 
GDA_TYPE_TIMESTAMP):\n"
                                         "   exp: DD=%d MM=%d YYYY=%d HH=%d MM=%d SS=%d FF=%ld TZ=%ld\\n"
                                         "   got: DD=%d MM=%d YYYY=%d HH=%d MM=%d SS=%d FF=%ld TZ=%ld\\n",
                                         str, td.exp_day, td.exp_month, td.exp_year,
-                                        tt.exp_time.hour, tt.exp_time.minute, tt.exp_time.second, 
tt.exp_time.fraction, tt.exp_time.timezone,
+                                        tt.hour, tt.minute, tt.second, tt.fraction, tt.timezone,
                                         gda_timestamp_get_year (timestamp), gda_timestamp_get_month 
(timestamp), gda_timestamp_get_day (timestamp),
                                         gda_timestamp_get_hour (timestamp), gda_timestamp_get_minute 
(timestamp),
                                         gda_timestamp_get_second (timestamp), gda_timestamp_get_fraction 
(timestamp), gda_timestamp_get_timezone (timestamp));
@@ -502,16 +502,16 @@ test_timestamp_handler (void)
                        if ((gda_timestamp_get_year (timestamp) != td.exp_year) ||
                            (gda_timestamp_get_month (timestamp) != td.exp_month) ||
                            (gda_timestamp_get_day (timestamp) != td.exp_day) ||
-                           (gda_timestamp_get_hour (timestamp) != tt.exp_time.hour) ||
-                           (gda_timestamp_get_minute (timestamp) != tt.exp_time.minute) ||
-                           (gda_timestamp_get_second (timestamp) != tt.exp_time.second) ||
-                           (gda_timestamp_get_fraction (timestamp) != tt.exp_time.fraction) ||
-                           (gda_timestamp_get_timezone (timestamp) != tt.exp_time.timezone)) {
+                           (gda_timestamp_get_hour (timestamp) != tt.hour) ||
+                           (gda_timestamp_get_minute (timestamp) != tt.minute) ||
+                           (gda_timestamp_get_second (timestamp) != tt.second) ||
+                           (gda_timestamp_get_fraction (timestamp) != tt.fraction) ||
+                           (gda_timestamp_get_timezone (timestamp) != tt.timezone)) {
                                g_print ("Wrong result for gda_data_handler_get_value_from_str (\"%s\", 
GDA_TYPE_TIMESTAMP):\n"
                                         "   exp: DD=%d MM=%d YYYY=%d HH=%d MM=%d SS=%d FF=%ld TZ=%ld\\n"
                                         "   got: DD=%d MM=%d YYYY=%d HH=%d MM=%d SS=%d FF=%ld TZ=%ld\\n",
                                         str, td.exp_day, td.exp_month, td.exp_year,
-                                        tt.exp_time.hour, tt.exp_time.minute, tt.exp_time.second, 
tt.exp_time.fraction, tt.exp_time.timezone,
+                                        tt.hour, tt.minute, tt.second, tt.fraction, tt.timezone,
                                         gda_timestamp_get_year (timestamp), gda_timestamp_get_month 
(timestamp),
                                         gda_timestamp_get_day (timestamp), gda_timestamp_get_hour 
(timestamp),
                                         gda_timestamp_get_minute (timestamp), gda_timestamp_get_second 
(timestamp),
diff --git a/tests/test-sql-renderer.c b/tests/test-sql-renderer.c
index c039532..9c14ccf 100644
--- a/tests/test-sql-renderer.c
+++ b/tests/test-sql-renderer.c
@@ -53,13 +53,6 @@ GdaTimestamp* create_timestamp (void) {
        return ts;
 }
 
-GdaTime gt = {
-       .hour = 16,
-       .minute = 9,
-       .second = 22,
-       .timezone = - 3600 * 3
-};
-
 
 /*
  * @prov may be NULL
@@ -72,6 +65,7 @@ do_a_test (GdaServerProvider *prov, GdaSqlParser *parser)
        GdaSet *params;
        gchar *sql;
        GError *error = NULL;
+       GdaTime* gt = gda_time_new_from_values (16, 9, 22, 0, -3600*3);
 
        /* SQL parsed as an INSERT statement */
        sql = "INSERT INTO tstest VALUES (##ts::timestamp, ##time::time)";
@@ -101,7 +95,7 @@ do_a_test (GdaServerProvider *prov, GdaSqlParser *parser)
                goto endtest;
        }
 
-       if (! gda_set_set_holder_value (params, &error, "time", &gt)) {
+       if (! gda_set_set_holder_value (params, &error, "time", gt)) {
                g_print ("Failed to bind 'time' parameter: %s\n", error && error->message ? error->message : 
"No detail");
                g_clear_error (&error);
                g_object_unref (stmt);
@@ -199,7 +193,7 @@ do_a_test (GdaServerProvider *prov, GdaSqlParser *parser)
        }
        gda_timestamp_free (ts);
 
-       if (! gda_set_set_holder_value (params, &error, "time", &gt)) {
+       if (! gda_set_set_holder_value (params, &error, "time", gt)) {
                g_print ("Failed to bind 'time' parameter: %s\n", error && error->message ? error->message : 
"No detail");
                g_clear_error (&error);
                g_object_unref (stmt);
@@ -255,6 +249,7 @@ do_a_test (GdaServerProvider *prov, GdaSqlParser *parser)
        g_free (sql);
 
  endtest:
+       gda_time_free (gt);
        return nfailed;
 }
 


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