Imported Upstream version 2.50.2
[platform/upstream/glib.git] / docs / reference / glib / html / glib-GTimeZone.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GTimeZone: GLib Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-utilities.html" title="GLib Utilities">
9 <link rel="prev" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions">
10 <link rel="next" href="glib-GDateTime.html" title="GDateTime">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#glib-GTimeZone.description" class="shortcut">Description</a></span>
19 </td>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="glib-Date-and-Time-Functions.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="glib-GDateTime.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24 </tr></table>
25 <div class="refentry">
26 <a name="glib-GTimeZone"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
28 <td valign="top">
29 <h2><span class="refentrytitle"><a name="glib-GTimeZone.top_of_page"></a>GTimeZone</span></h2>
30 <p>GTimeZone — a structure representing a time zone</p>
31 </td>
32 <td class="gallery_image" valign="top" align="right"></td>
33 </tr></table></div>
34 <div class="refsect1">
35 <a name="glib-GTimeZone.functions"></a><h2>Functions</h2>
36 <div class="informaltable"><table class="informaltable" width="100%" border="0">
37 <colgroup>
38 <col width="150px" class="functions_return">
39 <col class="functions_name">
40 </colgroup>
41 <tbody>
42 <tr>
43 <td class="function_type">
44 <span class="returnvalue">void</span>
45 </td>
46 <td class="function_name">
47 <a class="link" href="glib-GTimeZone.html#g-time-zone-unref" title="g_time_zone_unref ()">g_time_zone_unref</a> <span class="c_punctuation">()</span>
48 </td>
49 </tr>
50 <tr>
51 <td class="function_type">
52 <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
53 </td>
54 <td class="function_name">
55 <a class="link" href="glib-GTimeZone.html#g-time-zone-ref" title="g_time_zone_ref ()">g_time_zone_ref</a> <span class="c_punctuation">()</span>
56 </td>
57 </tr>
58 <tr>
59 <td class="function_type">
60 <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
61 </td>
62 <td class="function_name">
63 <a class="link" href="glib-GTimeZone.html#g-time-zone-new" title="g_time_zone_new ()">g_time_zone_new</a> <span class="c_punctuation">()</span>
64 </td>
65 </tr>
66 <tr>
67 <td class="function_type">
68 <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
69 </td>
70 <td class="function_name">
71 <a class="link" href="glib-GTimeZone.html#g-time-zone-new-local" title="g_time_zone_new_local ()">g_time_zone_new_local</a> <span class="c_punctuation">()</span>
72 </td>
73 </tr>
74 <tr>
75 <td class="function_type">
76 <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
77 </td>
78 <td class="function_name">
79 <a class="link" href="glib-GTimeZone.html#g-time-zone-new-utc" title="g_time_zone_new_utc ()">g_time_zone_new_utc</a> <span class="c_punctuation">()</span>
80 </td>
81 </tr>
82 <tr>
83 <td class="function_type">
84 <a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
85 </td>
86 <td class="function_name">
87 <a class="link" href="glib-GTimeZone.html#g-time-zone-find-interval" title="g_time_zone_find_interval ()">g_time_zone_find_interval</a> <span class="c_punctuation">()</span>
88 </td>
89 </tr>
90 <tr>
91 <td class="function_type">
92 <a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
93 </td>
94 <td class="function_name">
95 <a class="link" href="glib-GTimeZone.html#g-time-zone-adjust-time" title="g_time_zone_adjust_time ()">g_time_zone_adjust_time</a> <span class="c_punctuation">()</span>
96 </td>
97 </tr>
98 <tr>
99 <td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
100 </td>
101 <td class="function_name">
102 <a class="link" href="glib-GTimeZone.html#g-time-zone-get-abbreviation" title="g_time_zone_get_abbreviation ()">g_time_zone_get_abbreviation</a> <span class="c_punctuation">()</span>
103 </td>
104 </tr>
105 <tr>
106 <td class="function_type">
107 <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a>
108 </td>
109 <td class="function_name">
110 <a class="link" href="glib-GTimeZone.html#g-time-zone-get-offset" title="g_time_zone_get_offset ()">g_time_zone_get_offset</a> <span class="c_punctuation">()</span>
111 </td>
112 </tr>
113 <tr>
114 <td class="function_type">
115 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
116 </td>
117 <td class="function_name">
118 <a class="link" href="glib-GTimeZone.html#g-time-zone-is-dst" title="g_time_zone_is_dst ()">g_time_zone_is_dst</a> <span class="c_punctuation">()</span>
119 </td>
120 </tr>
121 </tbody>
122 </table></div>
123 </div>
124 <div class="refsect1">
125 <a name="glib-GTimeZone.other"></a><h2>Types and Values</h2>
126 <div class="informaltable"><table class="informaltable" width="100%" border="0">
127 <colgroup>
128 <col width="150px" class="name">
129 <col class="description">
130 </colgroup>
131 <tbody>
132 <tr>
133 <td class="datatype_keyword"> </td>
134 <td class="function_name"><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone">GTimeZone</a></td>
135 </tr>
136 <tr>
137 <td class="datatype_keyword">enum</td>
138 <td class="function_name"><a class="link" href="glib-GTimeZone.html#GTimeType" title="enum GTimeType">GTimeType</a></td>
139 </tr>
140 </tbody>
141 </table></div>
142 </div>
143 <div class="refsect1">
144 <a name="glib-GTimeZone.includes"></a><h2>Includes</h2>
145 <pre class="synopsis">#include &lt;glib.h&gt;
146 </pre>
147 </div>
148 <div class="refsect1">
149 <a name="glib-GTimeZone.description"></a><h2>Description</h2>
150 <p><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> is a structure that represents a time zone, at no
151 particular point in time.  It is refcounted and immutable.</p>
152 <p>A time zone contains a number of intervals.  Each interval has
153 an abbreviation to describe it, an offet to UTC and a flag indicating
154 if the daylight savings time is in effect during that interval.  A
155 time zone always has at least one interval -- interval 0.</p>
156 <p>Every UTC time is contained within exactly one interval, but a given
157 local time may be contained within zero, one or two intervals (due to
158 incontinuities associated with daylight savings time).</p>
159 <p>An interval may refer to a specific period of time (eg: the duration
160 of daylight savings time during 2010) or it may refer to many periods
161 of time that share the same properties (eg: all periods of daylight
162 savings time).  It is also possible (usually for political reasons)
163 that some properties (like the abbreviation) change between intervals
164 without other properties changing.</p>
165 <p><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> is available since GLib 2.26.</p>
166 </div>
167 <div class="refsect1">
168 <a name="glib-GTimeZone.functions_details"></a><h2>Functions</h2>
169 <div class="refsect2">
170 <a name="g-time-zone-unref"></a><h3>g_time_zone_unref ()</h3>
171 <pre class="programlisting"><span class="returnvalue">void</span>
172 g_time_zone_unref (<em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> *tz</code></em>);</pre>
173 <p>Decreases the reference count on <em class="parameter"><code>tz</code></em>
174 .</p>
175 <div class="refsect3">
176 <a name="g-time-zone-unref.parameters"></a><h4>Parameters</h4>
177 <div class="informaltable"><table class="informaltable" width="100%" border="0">
178 <colgroup>
179 <col width="150px" class="parameters_name">
180 <col class="parameters_description">
181 <col width="200px" class="parameters_annotations">
182 </colgroup>
183 <tbody><tr>
184 <td class="parameter_name"><p>tz</p></td>
185 <td class="parameter_description"><p>a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a></p></td>
186 <td class="parameter_annotations"> </td>
187 </tr></tbody>
188 </table></div>
189 </div>
190 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
191 </div>
192 <hr>
193 <div class="refsect2">
194 <a name="g-time-zone-ref"></a><h3>g_time_zone_ref ()</h3>
195 <pre class="programlisting"><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
196 g_time_zone_ref (<em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> *tz</code></em>);</pre>
197 <p>Increases the reference count on <em class="parameter"><code>tz</code></em>
198 .</p>
199 <div class="refsect3">
200 <a name="g-time-zone-ref.parameters"></a><h4>Parameters</h4>
201 <div class="informaltable"><table class="informaltable" width="100%" border="0">
202 <colgroup>
203 <col width="150px" class="parameters_name">
204 <col class="parameters_description">
205 <col width="200px" class="parameters_annotations">
206 </colgroup>
207 <tbody><tr>
208 <td class="parameter_name"><p>tz</p></td>
209 <td class="parameter_description"><p>a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a></p></td>
210 <td class="parameter_annotations"> </td>
211 </tr></tbody>
212 </table></div>
213 </div>
214 <div class="refsect3">
215 <a name="g-time-zone-ref.returns"></a><h4>Returns</h4>
216 <p> a new reference to <em class="parameter"><code>tz</code></em>
217 .</p>
218 </div>
219 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
220 </div>
221 <hr>
222 <div class="refsect2">
223 <a name="g-time-zone-new"></a><h3>g_time_zone_new ()</h3>
224 <pre class="programlisting"><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
225 g_time_zone_new (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *identifier</code></em>);</pre>
226 <p>Creates a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> corresponding to <em class="parameter"><code>identifier</code></em>
227 .</p>
228 <p><em class="parameter"><code>identifier</code></em>
229  can either be an RFC3339/ISO 8601 time offset or
230 something that would pass as a valid value for the <code class="literal">TZ</code> environment
231 variable (including <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>).</p>
232 <p>In Windows, <em class="parameter"><code>identifier</code></em>
233  can also be the unlocalized name of a time
234 zone for standard time, for example "Pacific Standard Time".</p>
235 <p>Valid RFC3339 time offsets are <code class="literal">"Z"</code> (for UTC) or
236 <code class="literal">"±hh:mm"</code>.  ISO 8601 additionally specifies
237 <code class="literal">"±hhmm"</code> and <code class="literal">"±hh"</code>.  Offsets are
238 time values to be added to Coordinated Universal Time (UTC) to get
239 the local time.</p>
240 <p>In UNIX, the <code class="literal">TZ</code> environment variable typically corresponds
241 to the name of a file in the zoneinfo database, or string in
242 "std offset [dst [offset],start[/time],end[/time]]" (POSIX) format.
243 There  are  no spaces in the specification. The name of standard
244 and daylight savings time zone must be three or more alphabetic
245 characters. Offsets are time values to be added to local time to
246 get Coordinated Universal Time (UTC) and should be
247 <code class="literal">"[±]hh[[:]mm[:ss]]"</code>.  Dates are either
248 <code class="literal">"Jn"</code> (Julian day with n between 1 and 365, leap
249 years not counted), <code class="literal">"n"</code> (zero-based Julian day
250 with n between 0 and 365) or <code class="literal">"Mm.w.d"</code> (day d
251 (0 &lt;= d &lt;= 6) of week w (1 &lt;= w &lt;= 5) of month m (1 &lt;= m &lt;= 12), day
252 0 is a Sunday).  Times are in local wall clock time, the default is
253 02:00:00.</p>
254 <p>In Windows, the "tzn[+|–]hh:mm[:ss]" format is used, but also
255 accepts POSIX format.  The Windows format uses US rules for all time
256 zones; daylight savings time is 60 minutes behind the standard time
257 with date and time of change taken from Pacific Standard Time.
258 Offsets are time values to be added to the local time to get
259 Coordinated Universal Time (UTC).</p>
260 <p>g_time_zone_new_local() calls this function with the value of the
261 <code class="literal">TZ</code> environment variable. This function itself is independent of
262 the value of <code class="literal">TZ</code>, but if <em class="parameter"><code>identifier</code></em>
263  is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then <code class="literal">/etc/localtime</code>
264 will be consulted to discover the correct time zone on UNIX and the
265 registry will be consulted or <code class="function">GetTimeZoneInformation()</code> will be used
266 to get the local time zone on Windows.</p>
267 <p>If intervals are not available, only time zone rules from <code class="literal">TZ</code>
268 environment variable or other means, then they will be computed
269 from year 1900 to 2037.  If the maximum year for the rules is
270 available and it is greater than 2037, then it will followed
271 instead.</p>
272 <p>See
273 <a class="ulink" href="http://tools.ietf.org/html/rfc3339#section-5.6" target="_top">RFC3339 §5.6</a>
274 for a precise definition of valid RFC3339 time offsets
275 (the <code class="literal">time-offset</code> expansion) and ISO 8601 for the
276 full list of valid time offsets.  See
277 <a class="ulink" href="http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html" target="_top">The GNU C Library manual</a>
278 for an explanation of the possible
279 values of the <code class="literal">TZ</code> environment variable. See
280 <a class="ulink" href="http://msdn.microsoft.com/en-us/library/ms912391%28v=winembedded.11%29.aspx" target="_top">Microsoft Time Zone Index Values</a>
281 for the list of time zones on Windows.</p>
282 <p>You should release the return value by calling <a class="link" href="glib-GTimeZone.html#g-time-zone-unref" title="g_time_zone_unref ()"><code class="function">g_time_zone_unref()</code></a>
283 when you are done with it.</p>
284 <div class="refsect3">
285 <a name="g-time-zone-new.parameters"></a><h4>Parameters</h4>
286 <div class="informaltable"><table class="informaltable" width="100%" border="0">
287 <colgroup>
288 <col width="150px" class="parameters_name">
289 <col class="parameters_description">
290 <col width="200px" class="parameters_annotations">
291 </colgroup>
292 <tbody><tr>
293 <td class="parameter_name"><p>identifier</p></td>
294 <td class="parameter_description"><p> a timezone identifier. </p></td>
295 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
296 </tr></tbody>
297 </table></div>
298 </div>
299 <div class="refsect3">
300 <a name="g-time-zone-new.returns"></a><h4>Returns</h4>
301 <p> the requested timezone</p>
302 </div>
303 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
304 </div>
305 <hr>
306 <div class="refsect2">
307 <a name="g-time-zone-new-local"></a><h3>g_time_zone_new_local ()</h3>
308 <pre class="programlisting"><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
309 g_time_zone_new_local (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
310 <p>Creates a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> corresponding to local time.  The local time
311 zone may change between invocations to this function; for example,
312 if the system administrator changes it.</p>
313 <p>This is equivalent to calling <a class="link" href="glib-GTimeZone.html#g-time-zone-new" title="g_time_zone_new ()"><code class="function">g_time_zone_new()</code></a> with the value of
314 the <code class="literal">TZ</code> environment variable (including the possibility of <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>).</p>
315 <p>You should release the return value by calling <a class="link" href="glib-GTimeZone.html#g-time-zone-unref" title="g_time_zone_unref ()"><code class="function">g_time_zone_unref()</code></a>
316 when you are done with it.</p>
317 <div class="refsect3">
318 <a name="g-time-zone-new-local.returns"></a><h4>Returns</h4>
319 <p> the local timezone</p>
320 </div>
321 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
322 </div>
323 <hr>
324 <div class="refsect2">
325 <a name="g-time-zone-new-utc"></a><h3>g_time_zone_new_utc ()</h3>
326 <pre class="programlisting"><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="returnvalue">GTimeZone</span></a> *
327 g_time_zone_new_utc (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
328 <p>Creates a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> corresponding to UTC.</p>
329 <p>This is equivalent to calling <a class="link" href="glib-GTimeZone.html#g-time-zone-new" title="g_time_zone_new ()"><code class="function">g_time_zone_new()</code></a> with a value like
330 "Z", "UTC", "+00", etc.</p>
331 <p>You should release the return value by calling <a class="link" href="glib-GTimeZone.html#g-time-zone-unref" title="g_time_zone_unref ()"><code class="function">g_time_zone_unref()</code></a>
332 when you are done with it.</p>
333 <div class="refsect3">
334 <a name="g-time-zone-new-utc.returns"></a><h4>Returns</h4>
335 <p> the universal timezone</p>
336 </div>
337 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
338 </div>
339 <hr>
340 <div class="refsect2">
341 <a name="g-time-zone-find-interval"></a><h3>g_time_zone_find_interval ()</h3>
342 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
343 g_time_zone_find_interval (<em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> *tz</code></em>,
344                            <em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeType" title="enum GTimeType"><span class="type">GTimeType</span></a> type</code></em>,
345                            <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> time_</code></em>);</pre>
346 <p>Finds an the interval within <em class="parameter"><code>tz</code></em>
347  that corresponds to the given <em class="parameter"><code>time_</code></em>
348 .
349 The meaning of <em class="parameter"><code>time_</code></em>
350  depends on <em class="parameter"><code>type</code></em>
351 .</p>
352 <p>If <em class="parameter"><code>type</code></em>
353  is <a class="link" href="glib-GTimeZone.html#G-TIME-TYPE-UNIVERSAL:CAPS"><code class="literal">G_TIME_TYPE_UNIVERSAL</code></a> then this function will always
354 succeed (since universal time is monotonic and continuous).</p>
355 <p>Otherwise <em class="parameter"><code>time_</code></em>
356  is treated as local time.  The distinction between
357 <a class="link" href="glib-GTimeZone.html#G-TIME-TYPE-STANDARD:CAPS"><code class="literal">G_TIME_TYPE_STANDARD</code></a> and <a class="link" href="glib-GTimeZone.html#G-TIME-TYPE-DAYLIGHT:CAPS"><code class="literal">G_TIME_TYPE_DAYLIGHT</code></a> is ignored except in
358 the case that the given <em class="parameter"><code>time_</code></em>
359  is ambiguous.  In Toronto, for example,
360 01:30 on November 7th 2010 occurred twice (once inside of daylight
361 savings time and the next, an hour later, outside of daylight savings
362 time).  In this case, the different value of <em class="parameter"><code>type</code></em>
363  would result in a
364 different interval being returned.</p>
365 <p>It is still possible for this function to fail.  In Toronto, for
366 example, 02:00 on March 14th 2010 does not exist (due to the leap
367 forward to begin daylight savings time).  -1 is returned in that
368 case.</p>
369 <div class="refsect3">
370 <a name="g-time-zone-find-interval.parameters"></a><h4>Parameters</h4>
371 <div class="informaltable"><table class="informaltable" width="100%" border="0">
372 <colgroup>
373 <col width="150px" class="parameters_name">
374 <col class="parameters_description">
375 <col width="200px" class="parameters_annotations">
376 </colgroup>
377 <tbody>
378 <tr>
379 <td class="parameter_name"><p>tz</p></td>
380 <td class="parameter_description"><p>a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a></p></td>
381 <td class="parameter_annotations"> </td>
382 </tr>
383 <tr>
384 <td class="parameter_name"><p>type</p></td>
385 <td class="parameter_description"><p>the <a class="link" href="glib-GTimeZone.html#GTimeType" title="enum GTimeType"><span class="type">GTimeType</span></a> of <em class="parameter"><code>time_</code></em>
386 </p></td>
387 <td class="parameter_annotations"> </td>
388 </tr>
389 <tr>
390 <td class="parameter_name"><p>time_</p></td>
391 <td class="parameter_description"><p>a number of seconds since January 1, 1970</p></td>
392 <td class="parameter_annotations"> </td>
393 </tr>
394 </tbody>
395 </table></div>
396 </div>
397 <div class="refsect3">
398 <a name="g-time-zone-find-interval.returns"></a><h4>Returns</h4>
399 <p> the interval containing <em class="parameter"><code>time_</code></em>
400 , or -1 in case of failure</p>
401 </div>
402 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
403 </div>
404 <hr>
405 <div class="refsect2">
406 <a name="g-time-zone-adjust-time"></a><h3>g_time_zone_adjust_time ()</h3>
407 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
408 g_time_zone_adjust_time (<em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> *tz</code></em>,
409                          <em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeType" title="enum GTimeType"><span class="type">GTimeType</span></a> type</code></em>,
410                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> *time_</code></em>);</pre>
411 <p>Finds an interval within <em class="parameter"><code>tz</code></em>
412  that corresponds to the given <em class="parameter"><code>time_</code></em>
413 ,
414 possibly adjusting <em class="parameter"><code>time_</code></em>
415  if required to fit into an interval.
416 The meaning of <em class="parameter"><code>time_</code></em>
417  depends on <em class="parameter"><code>type</code></em>
418 .</p>
419 <p>This function is similar to <a class="link" href="glib-GTimeZone.html#g-time-zone-find-interval" title="g_time_zone_find_interval ()"><code class="function">g_time_zone_find_interval()</code></a>, with the
420 difference that it always succeeds (by making the adjustments
421 described below).</p>
422 <p>In any of the cases where <a class="link" href="glib-GTimeZone.html#g-time-zone-find-interval" title="g_time_zone_find_interval ()"><code class="function">g_time_zone_find_interval()</code></a> succeeds then
423 this function returns the same value, without modifying <em class="parameter"><code>time_</code></em>
424 .</p>
425 <p>This function may, however, modify <em class="parameter"><code>time_</code></em>
426  in order to deal with
427 non-existent times.  If the non-existent local <em class="parameter"><code>time_</code></em>
428  of 02:30 were
429 requested on March 14th 2010 in Toronto then this function would
430 adjust <em class="parameter"><code>time_</code></em>
431  to be 03:00 and return the interval containing the
432 adjusted time.</p>
433 <div class="refsect3">
434 <a name="g-time-zone-adjust-time.parameters"></a><h4>Parameters</h4>
435 <div class="informaltable"><table class="informaltable" width="100%" border="0">
436 <colgroup>
437 <col width="150px" class="parameters_name">
438 <col class="parameters_description">
439 <col width="200px" class="parameters_annotations">
440 </colgroup>
441 <tbody>
442 <tr>
443 <td class="parameter_name"><p>tz</p></td>
444 <td class="parameter_description"><p>a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a></p></td>
445 <td class="parameter_annotations"> </td>
446 </tr>
447 <tr>
448 <td class="parameter_name"><p>type</p></td>
449 <td class="parameter_description"><p>the <a class="link" href="glib-GTimeZone.html#GTimeType" title="enum GTimeType"><span class="type">GTimeType</span></a> of <em class="parameter"><code>time_</code></em>
450 </p></td>
451 <td class="parameter_annotations"> </td>
452 </tr>
453 <tr>
454 <td class="parameter_name"><p>time_</p></td>
455 <td class="parameter_description"><p>a pointer to a number of seconds since January 1, 1970</p></td>
456 <td class="parameter_annotations"> </td>
457 </tr>
458 </tbody>
459 </table></div>
460 </div>
461 <div class="refsect3">
462 <a name="g-time-zone-adjust-time.returns"></a><h4>Returns</h4>
463 <p> the interval containing <em class="parameter"><code>time_</code></em>
464 , never -1</p>
465 </div>
466 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
467 </div>
468 <hr>
469 <div class="refsect2">
470 <a name="g-time-zone-get-abbreviation"></a><h3>g_time_zone_get_abbreviation ()</h3>
471 <pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
472 g_time_zone_get_abbreviation (<em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> *tz</code></em>,
473                               <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> interval</code></em>);</pre>
474 <p>Determines the time zone abbreviation to be used during a particular
475 <em class="parameter"><code>interval</code></em>
476  of time in the time zone <em class="parameter"><code>tz</code></em>
477 .</p>
478 <p>For example, in Toronto this is currently "EST" during the winter
479 months and "EDT" during the summer months when daylight savings time
480 is in effect.</p>
481 <div class="refsect3">
482 <a name="g-time-zone-get-abbreviation.parameters"></a><h4>Parameters</h4>
483 <div class="informaltable"><table class="informaltable" width="100%" border="0">
484 <colgroup>
485 <col width="150px" class="parameters_name">
486 <col class="parameters_description">
487 <col width="200px" class="parameters_annotations">
488 </colgroup>
489 <tbody>
490 <tr>
491 <td class="parameter_name"><p>tz</p></td>
492 <td class="parameter_description"><p>a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a></p></td>
493 <td class="parameter_annotations"> </td>
494 </tr>
495 <tr>
496 <td class="parameter_name"><p>interval</p></td>
497 <td class="parameter_description"><p>an interval within the timezone</p></td>
498 <td class="parameter_annotations"> </td>
499 </tr>
500 </tbody>
501 </table></div>
502 </div>
503 <div class="refsect3">
504 <a name="g-time-zone-get-abbreviation.returns"></a><h4>Returns</h4>
505 <p> the time zone abbreviation, which belongs to <em class="parameter"><code>tz</code></em>
506 </p>
507 </div>
508 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
509 </div>
510 <hr>
511 <div class="refsect2">
512 <a name="g-time-zone-get-offset"></a><h3>g_time_zone_get_offset ()</h3>
513 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a>
514 g_time_zone_get_offset (<em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> *tz</code></em>,
515                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> interval</code></em>);</pre>
516 <p>Determines the offset to UTC in effect during a particular <em class="parameter"><code>interval</code></em>
517
518 of time in the time zone <em class="parameter"><code>tz</code></em>
519 .</p>
520 <p>The offset is the number of seconds that you add to UTC time to
521 arrive at local time for <em class="parameter"><code>tz</code></em>
522  (ie: negative numbers for time zones
523 west of GMT, positive numbers for east).</p>
524 <div class="refsect3">
525 <a name="g-time-zone-get-offset.parameters"></a><h4>Parameters</h4>
526 <div class="informaltable"><table class="informaltable" width="100%" border="0">
527 <colgroup>
528 <col width="150px" class="parameters_name">
529 <col class="parameters_description">
530 <col width="200px" class="parameters_annotations">
531 </colgroup>
532 <tbody>
533 <tr>
534 <td class="parameter_name"><p>tz</p></td>
535 <td class="parameter_description"><p>a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a></p></td>
536 <td class="parameter_annotations"> </td>
537 </tr>
538 <tr>
539 <td class="parameter_name"><p>interval</p></td>
540 <td class="parameter_description"><p>an interval within the timezone</p></td>
541 <td class="parameter_annotations"> </td>
542 </tr>
543 </tbody>
544 </table></div>
545 </div>
546 <div class="refsect3">
547 <a name="g-time-zone-get-offset.returns"></a><h4>Returns</h4>
548 <p> the number of seconds that should be added to UTC to get the
549 local time in <em class="parameter"><code>tz</code></em>
550 </p>
551 </div>
552 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
553 </div>
554 <hr>
555 <div class="refsect2">
556 <a name="g-time-zone-is-dst"></a><h3>g_time_zone_is_dst ()</h3>
557 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
558 g_time_zone_is_dst (<em class="parameter"><code><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> *tz</code></em>,
559                     <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> interval</code></em>);</pre>
560 <p>Determines if daylight savings time is in effect during a particular
561 <em class="parameter"><code>interval</code></em>
562  of time in the time zone <em class="parameter"><code>tz</code></em>
563 .</p>
564 <div class="refsect3">
565 <a name="g-time-zone-is-dst.parameters"></a><h4>Parameters</h4>
566 <div class="informaltable"><table class="informaltable" width="100%" border="0">
567 <colgroup>
568 <col width="150px" class="parameters_name">
569 <col class="parameters_description">
570 <col width="200px" class="parameters_annotations">
571 </colgroup>
572 <tbody>
573 <tr>
574 <td class="parameter_name"><p>tz</p></td>
575 <td class="parameter_description"><p>a <a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a></p></td>
576 <td class="parameter_annotations"> </td>
577 </tr>
578 <tr>
579 <td class="parameter_name"><p>interval</p></td>
580 <td class="parameter_description"><p>an interval within the timezone</p></td>
581 <td class="parameter_annotations"> </td>
582 </tr>
583 </tbody>
584 </table></div>
585 </div>
586 <div class="refsect3">
587 <a name="g-time-zone-is-dst.returns"></a><h4>Returns</h4>
588 <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if daylight savings time is in effect</p>
589 </div>
590 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
591 </div>
592 </div>
593 <div class="refsect1">
594 <a name="glib-GTimeZone.other_details"></a><h2>Types and Values</h2>
595 <div class="refsect2">
596 <a name="GTimeZone"></a><h3>GTimeZone</h3>
597 <pre class="programlisting">typedef struct _GTimeZone GTimeZone;</pre>
598 <p><a class="link" href="glib-GTimeZone.html#GTimeZone" title="GTimeZone"><span class="type">GTimeZone</span></a> is an opaque structure whose members cannot be accessed
599 directly.</p>
600 <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
601 </div>
602 <hr>
603 <div class="refsect2">
604 <a name="GTimeType"></a><h3>enum GTimeType</h3>
605 <p>Disambiguates a given time in two ways.</p>
606 <p>First, specifies if the given time is in universal or local time.</p>
607 <p>Second, if the time is in local time, specifies if it is local
608 standard time or local daylight time.  This is important for the case
609 where the same local time occurs twice (during daylight savings time
610 transitions, for example).</p>
611 <div class="refsect3">
612 <a name="GTimeType.members"></a><h4>Members</h4>
613 <div class="informaltable"><table class="informaltable" width="100%" border="0">
614 <colgroup>
615 <col width="300px" class="enum_members_name">
616 <col class="enum_members_description">
617 <col width="200px" class="enum_members_annotations">
618 </colgroup>
619 <tbody>
620 <tr>
621 <td class="enum_member_name"><p><a name="G-TIME-TYPE-STANDARD:CAPS"></a>G_TIME_TYPE_STANDARD</p></td>
622 <td class="enum_member_description">
623 <p>the time is in local standard time</p>
624 </td>
625 <td class="enum_member_annotations"> </td>
626 </tr>
627 <tr>
628 <td class="enum_member_name"><p><a name="G-TIME-TYPE-DAYLIGHT:CAPS"></a>G_TIME_TYPE_DAYLIGHT</p></td>
629 <td class="enum_member_description">
630 <p>the time is in local daylight time</p>
631 </td>
632 <td class="enum_member_annotations"> </td>
633 </tr>
634 <tr>
635 <td class="enum_member_name"><p><a name="G-TIME-TYPE-UNIVERSAL:CAPS"></a>G_TIME_TYPE_UNIVERSAL</p></td>
636 <td class="enum_member_description">
637 <p>the time is in UTC</p>
638 </td>
639 <td class="enum_member_annotations"> </td>
640 </tr>
641 </tbody>
642 </table></div>
643 </div>
644 </div>
645 </div>
646 <div class="refsect1">
647 <a name="glib-GTimeZone.see-also"></a><h2>See Also</h2>
648 <p><a class="link" href="glib-GDateTime.html#GDateTime" title="GDateTime"><span class="type">GDateTime</span></a></p>
649 </div>
650 </div>
651 <div class="footer">
652 <hr>Generated by GTK-Doc V1.25.1</div>
653 </body>
654 </html>