![]() |
![]() |
![]() |
GLib Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
Synopsis
#include <glib.h> GTimeZone; void g_time_zone_unref (GTimeZone *tz
); GTimeZone * g_time_zone_ref (GTimeZone *tz
); GTimeZone * g_time_zone_new (const gchar *identifier
); GTimeZone * g_time_zone_new_local (void
); GTimeZone * g_time_zone_new_utc (void
);
Description
GTimeZone is a structure that represents a time zone, at no particular point in time. It is refcounted and immutable.
GTimeZone is available since GLib 2.26.
Details
GTimeZone
typedef struct _GTimeZone GTimeZone;
GDateTime is an opaque structure whose members cannot be accessed directly.
Since 2.26
g_time_zone_unref ()
void g_time_zone_unref (GTimeZone *tz
);
Decreases the reference count on tz
.
|
a GTimeZone |
Since 2.26
g_time_zone_ref ()
GTimeZone * g_time_zone_ref (GTimeZone *tz
);
Increases the reference count on tz
.
|
a GTimeZone |
Returns : |
a new reference to tz .
|
Since 2.26
g_time_zone_new ()
GTimeZone * g_time_zone_new (const gchar *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
TZ
environment variable (including NULL
).
Valid RFC3339 time offsets are "Z"
(for UTC) or
"±hh:mm"
. ISO 8601 additionally specifies
"±hhmm"
and "±hh"
.
The TZ
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
TZ
environment variable. This function itself is
independent of the value of TZ
, but if identifier
is NULL
then /etc/localtime
will be consulted
to discover the correct timezone.
See RFC3339
§5.6 for a precise definition of valid RFC3339 time offsets
(the time-offset
expansion) and ISO 8601 for the
full list of valid time offsets. See The
GNU C Library manual for an explanation of the possible
values of the TZ
environment variable.
You should release the return value by calling g_time_zone_unref()
when you are done with it.
|
a timezone identifier. [allow-none] |
Returns : |
the requested timezone |
Since 2.26
g_time_zone_new_local ()
GTimeZone * g_time_zone_new_local (void
);
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
). Changes made to TZ
after the first
call to this function may or may not be noticed by future calls.
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
g_time_zone_new_utc ()
GTimeZone * g_time_zone_new_utc (void
);
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