Function

GLibTimeZonenew_offset

since: 2.58

Declaration

GTimeZone*
g_time_zone_new_offset (
  gint32 seconds
)

Description

Creates a GTimeZone corresponding to the given constant offset from UTC, in seconds.

This is equivalent to calling g_time_zone_new() with a string in the form [+|-]hh[:mm[:ss]].

It is possible for this function to fail if seconds is too big (greater than 24 hours), in which case this function will return the UTC timezone for backwards compatibility. To detect failures like this, use g_time_zone_new_identifier() directly.

Available since: 2.58

Parameters

seconds

Type: gint32

Offset to UTC, in seconds.

Return value

Type: GTimeZone

A timezone at the given offset from UTC, or UTC on failure.

The caller of the function takes ownership of the data, and is responsible for freeing it.