Libical API Documentation 3.0

icaltimezone.h
Go to the documentation of this file.
1/*======================================================================
2 FILE: icaltimezone.h
3 CREATOR: Damon Chaplin 15 March 2001
4
5 (C) COPYRIGHT 2001, Damon Chaplin <damon@ximian.com>
6
7 This library is free software; you can redistribute it and/or modify
8 it under the terms of either:
9
10 The LGPL as published by the Free Software Foundation, version
11 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
12
13 Or:
14
15 The Mozilla Public License Version 2.0. You may obtain a copy of
16 the License at https://www.mozilla.org/MPL/
17======================================================================*/
23#ifndef ICALTIMEZONE_H
24#define ICALTIMEZONE_H
25
26#include "libical_ical_export.h"
27#include "icalcomponent.h"
28
29#include <stdio.h>
30
31#if !defined(ICALTIMEZONE_DEFINED)
32#define ICALTIMEZONE_DEFINED
36 typedef struct _icaltimezone icaltimezone;
37#endif
38
39/*
40 * Creating/Destroying individual icaltimezones.
41 */
42
44LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_new(void);
45
46LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_copy(icaltimezone *originalzone);
47
52LIBICAL_ICAL_EXPORT void icaltimezone_free(icaltimezone *zone, int free_struct);
53
59LIBICAL_ICAL_EXPORT void icaltimezone_set_tzid_prefix(const char *new_prefix);
60
61/*
62 * Accessing timezones.
63 */
64
66LIBICAL_ICAL_EXPORT void icaltimezone_free_builtin_timezones(void);
67
75LIBICAL_ICAL_EXPORT icalarray *icaltimezone_get_builtin_timezones(void);
76
78LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_get_builtin_timezone(const char *location);
79
81LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_get_builtin_timezone_from_offset(int offset,
82 const char *tzname);
83
85LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_get_builtin_timezone_from_tzid(const char *tzid);
86
88LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_get_utc_timezone(void);
89
91LIBICAL_ICAL_EXPORT const char *icaltimezone_get_tzid(icaltimezone *zone);
92
94LIBICAL_ICAL_EXPORT const char *icaltimezone_get_location(icaltimezone *zone);
95
100LIBICAL_ICAL_EXPORT const char *icaltimezone_get_tznames(icaltimezone *zone);
101
103LIBICAL_ICAL_EXPORT double icaltimezone_get_latitude(icaltimezone *zone);
104
106LIBICAL_ICAL_EXPORT double icaltimezone_get_longitude(icaltimezone *zone);
107
109LIBICAL_ICAL_EXPORT icalcomponent *icaltimezone_get_component(icaltimezone *zone);
110
116LIBICAL_ICAL_EXPORT int icaltimezone_set_component(icaltimezone *zone, icalcomponent *comp);
117
124LIBICAL_ICAL_EXPORT const char *icaltimezone_get_display_name(icaltimezone *zone);
125
126/*
127 * Converting times between timezones.
128 */
129
130LIBICAL_ICAL_EXPORT void icaltimezone_convert_time(struct icaltimetype *tt,
131 icaltimezone *from_zone,
132 icaltimezone *to_zone);
133
134/*
135 * Getting offsets from UTC.
136 */
137
145LIBICAL_ICAL_EXPORT int icaltimezone_get_utc_offset(icaltimezone *zone,
146 struct icaltimetype *tt, int *is_daylight);
147
154LIBICAL_ICAL_EXPORT int icaltimezone_get_utc_offset_of_utc_time(icaltimezone *zone,
155 struct icaltimetype *tt,
156 int *is_daylight);
157
158/*
159 * Handling arrays of timezones. Mainly for internal use.
160 */
161LIBICAL_ICAL_EXPORT icalarray *icaltimezone_array_new(void);
162
163LIBICAL_ICAL_EXPORT void icaltimezone_array_append_from_vtimezone(icalarray *timezones,
164 icalcomponent *child);
165
166LIBICAL_ICAL_EXPORT void icaltimezone_array_free(icalarray *timezones);
167
168/*
169 * By request (issue #112) make vtimezone functions public
170 */
171LIBICAL_ICAL_EXPORT void icaltimezone_expand_vtimezone(icalcomponent *comp,
172 int end_year, icalarray *changes);
173
175LIBICAL_ICAL_EXPORT char *icaltimezone_get_location_from_vtimezone(icalcomponent *component);
176
183LIBICAL_ICAL_EXPORT char *icaltimezone_get_tznames_from_vtimezone(icalcomponent *component);
184
185/*
186 * Truncate a VTIMEZONE component to the given start and end times.
187 * If either time is null, then no truncation will occur at that point.
188 * If either time is non-null, then it MUST be specified as UTC.
189 * If the start time is non-null and ms_compatible is zero,
190 * then the DTSTART of RRULEs will be adjusted to occur after the start time.
191 * @since 3.0.6
192 */
193LIBICAL_ICAL_EXPORT void icaltimezone_truncate_vtimezone(icalcomponent *vtz,
194 icaltimetype start,
195 icaltimetype end,
196 int ms_compatible);
197
198/*
199 * @par Handling the default location the timezone files
200 */
201
203LIBICAL_ICAL_EXPORT void set_zone_directory(const char *path);
204
206LIBICAL_ICAL_EXPORT void free_zone_directory(void);
207
208LIBICAL_ICAL_EXPORT void icaltimezone_release_zone_tab(void);
209
210/*
211 * @par Handling whether to use builtin timezone files
212 */
213LIBICAL_ICAL_EXPORT void icaltimezone_set_builtin_tzdata(int set);
214
215LIBICAL_ICAL_EXPORT int icaltimezone_get_builtin_tzdata(void);
216
217/*
218 * Debugging Output.
219 */
220
238LIBICAL_ICAL_EXPORT int icaltimezone_dump_changes(icaltimezone *zone, int max_year, FILE *fp);
239
240/* For the library only -- do not make visible */
241 extern const char *icaltimezone_tzid_prefix(void);
242
243#endif /* ICALTIMEZONE_H */
icalcomponent.h
icaltimezone_new
icaltimezone * icaltimezone_new(void)
Creates a new icaltimezone.
Definition: icaltimezone.c:211
icaltimezone_set_tzid_prefix
void icaltimezone_set_tzid_prefix(const char *new_prefix)
Definition: icaltimezone.c:2170
icaltimezone_get_builtin_timezone_from_offset
icaltimezone * icaltimezone_get_builtin_timezone_from_offset(int offset, const char *tzname)
Returns a single builtin timezone, given its offset from UTC.
Definition: icaltimezone.c:1444
icaltimezone_dump_changes
int icaltimezone_dump_changes(icaltimezone *zone, int max_year, FILE *fp)
Outputs a list of timezone changes for the given timezone to the given file, up to the maximum year g...
Definition: icaltimezone.c:1943
icaltimezone_get_utc_offset
int icaltimezone_get_utc_offset(icaltimezone *zone, struct icaltimetype *tt, int *is_daylight)
Calculates the UTC offset of a given local time in the given timezone.
Definition: icaltimezone.c:818
icaltimezone_get_longitude
double icaltimezone_get_longitude(icaltimezone *zone)
Returns the longitude of a builtin timezone.
Definition: icaltimezone.c:1226
free_zone_directory
void free_zone_directory(void)
Definition: icaltimezone.c:2162
icaltimezone_get_location_from_vtimezone
char * icaltimezone_get_location_from_vtimezone(icalcomponent *component)
Gets the LOCATION or X-LIC-LOCATION property from a VTIMEZONE.
Definition: icaltimezone.c:354
icaltimezone_get_tznames_from_vtimezone
char * icaltimezone_get_tznames_from_vtimezone(icalcomponent *component)
Gets the TZNAMEs used for the last STANDARD & DAYLIGHT components in a VTIMEZONE.
Definition: icaltimezone.c:381
icaltimezone_get_component
icalcomponent * icaltimezone_get_component(icaltimezone *zone)
Returns the VTIMEZONE component of a timezone.
Definition: icaltimezone.c:1237
icaltimezone_free_builtin_timezones
void icaltimezone_free_builtin_timezones(void)
Releases builtin timezone memory.
Definition: icaltimezone.c:1340
icaltimezone_get_tznames
const char * icaltimezone_get_tznames(icaltimezone *zone)
Definition: icaltimezone.c:1204
icaltimezone_get_builtin_timezone
icaltimezone * icaltimezone_get_builtin_timezone(const char *location)
Returns a single builtin timezone, given its Olson city name.
Definition: icaltimezone.c:1346
icaltimezone_get_location
const char * icaltimezone_get_location(icaltimezone *zone)
Definition: icaltimezone.c:1193
icaltimezone_get_builtin_timezones
icalarray * icaltimezone_get_builtin_timezones(void)
Returns an icalarray of icaltimezone structs, one for each builtin timezone.
Definition: icaltimezone.c:1332
icaltimezone_get_tzid
const char * icaltimezone_get_tzid(icaltimezone *zone)
Definition: icaltimezone.c:1182
icaltimezone_get_utc_timezone
icaltimezone * icaltimezone_get_utc_timezone(void)
Returns the UTC timezone.
Definition: icaltimezone.c:1541
icaltimezone_free
void icaltimezone_free(icaltimezone *zone, int free_struct)
Frees all memory used for the icaltimezone.
Definition: icaltimezone.c:260
icaltimezone_get_display_name
const char * icaltimezone_get_display_name(icaltimezone *zone)
Returns the timezone name to display to the user.
Definition: icaltimezone.c:1273
icaltimezone_set_component
int icaltimezone_set_component(icaltimezone *zone, icalcomponent *comp)
Sets the VTIMEZONE component of an icaltimezone, initializing the tzid, location & tzname fields.
Definition: icaltimezone.c:1248
icaltimezone_get_latitude
double icaltimezone_get_latitude(icaltimezone *zone)
Returns the latitude of a builtin timezone.
Definition: icaltimezone.c:1215
icaltimezone_get_builtin_timezone_from_tzid
icaltimezone * icaltimezone_get_builtin_timezone_from_tzid(const char *tzid)
Returns a single builtin timezone, given its TZID.
Definition: icaltimezone.c:1475
set_zone_directory
void set_zone_directory(const char *path)
Definition: icaltimezone.c:2151
icaltimezone_get_utc_offset_of_utc_time
int icaltimezone_get_utc_offset_of_utc_time(icaltimezone *zone, struct icaltimetype *tt, int *is_daylight)
Calculates the UTC offset of a given UTC time in the given timezone.
Definition: icaltimezone.c:975
_icalarray
Definition: icalarray.h:36
_icaltimezone
Definition: icaltimezoneimpl.h:23
_icaltimezone::component
icalcomponent * component
Definition: icaltimezoneimpl.h:49
_icaltimezone::changes
icalarray * changes
Definition: icaltimezoneimpl.h:65
_icaltimezone::location
char * location
Definition: icaltimezoneimpl.h:30
_icaltimezone::tzid
char * tzid
Definition: icaltimezoneimpl.h:24
_icaltimezone::end_year
int end_year
Definition: icaltimezoneimpl.h:60
icalcomponent_impl
Definition: icalcomponent.c:36
icaltimetype
Definition: icaltime.h:105