Method

GLibTimeZonefind_interval

since: 2.26

Declaration

gint
g_time_zone_find_interval (
  GTimeZone* tz,
  GTimeType type,
  gint64 time_
)

Description

Finds an 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 time_ is treated as local time. 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 occurred 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.

It is still possible for this function to fail. In Toronto, for example, 02:00 on March 14th 2010 does not exist (due to the leap forward to begin daylight savings time). -1 is returned in that case.

Available since: 2.26

Parameters

type

Type: GTimeType

The GTimeType of time_

time_

Type: gint64

A number of seconds since January 1, 1970

Return value

Type: gint

The interval containing time_, or -1 in case of failure.