Function

GLibTimeValfrom_iso8601

Declaration

gboolean
g_time_val_from_iso8601 (
  const gchar* iso_date,
  GTimeVal* time_
)

Description

Converts a string containing an ISO 8601 encoded date and time to a GTimeVal and puts it into time_.

iso_date must include year, month, day, hours, minutes, and seconds. It can optionally include fractions of a second and a time zone indicator. (In the absence of any time zone indication, the timestamp is assumed to be in local time.)

Any leading or trailing space in iso_date is ignored.

This function was deprecated, along with GTimeVal itself, in GLib 2.62. Equivalent functionality is available using code like:

GDateTime *dt = g_date_time_new_from_iso8601 (iso8601_string, NULL);
gint64 time_val = g_date_time_to_unix (dt);
g_date_time_unref (dt);
Available since:2.12
Deprecated since:2.62

GTimeVal is not year-2038-safe. Use g_date_time_new_from_iso8601() instead.

Parameters

iso_date

Type: const gchar*

An ISO 8601 encoded date string.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
time_

Type: GTimeVal

A GTimeVal.

The argument will be set by the function.
The data is owned by the caller of the function.

Return value

Type: gboolean

TRUE if the conversion was successful.