Libical API Documentation 3.0
Loading...
Searching...
No Matches
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
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
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,
173
176
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 const char *get_zone_directory(void);
204
206LIBICAL_ICAL_EXPORT void set_zone_directory(const char *path);
207
209LIBICAL_ICAL_EXPORT void free_zone_directory(void);
210
211LIBICAL_ICAL_EXPORT void icaltimezone_release_zone_tab(void);
212
213/*
214 * @par Handling whether to use builtin timezone files
215 */
216LIBICAL_ICAL_EXPORT void icaltimezone_set_builtin_tzdata(int set);
217
218LIBICAL_ICAL_EXPORT int icaltimezone_get_builtin_tzdata(void);
219
220/*
221 * Debugging Output.
222 */
223
241LIBICAL_ICAL_EXPORT int icaltimezone_dump_changes(icaltimezone *zone, int max_year, FILE *fp);
242
243/* For the library only -- do not make visible */
244extern const char *icaltimezone_tzid_prefix(void);
245
246#endif /* ICALTIMEZONE_H */
icaltimezone * icaltimezone_new(void)
Creates a new icaltimezone.
Definition icaltimezone.c:211
void icaltimezone_set_tzid_prefix(const char *new_prefix)
Definition icaltimezone.c:2186
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:1445
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:1944
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
double icaltimezone_get_longitude(icaltimezone *zone)
Returns the longitude of a builtin timezone.
Definition icaltimezone.c:1226
void free_zone_directory(void)
Definition icaltimezone.c:2178
char * icaltimezone_get_location_from_vtimezone(icalcomponent *component)
Gets the LOCATION or X-LIC-LOCATION property from a VTIMEZONE.
Definition icaltimezone.c:354
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
const char * get_zone_directory(void)
Definition icaltimezone.c:2158
icalcomponent * icaltimezone_get_component(icaltimezone *zone)
Returns the VTIMEZONE component of a timezone.
Definition icaltimezone.c:1237
void icaltimezone_free_builtin_timezones(void)
Releases builtin timezone memory.
Definition icaltimezone.c:1340
const char * icaltimezone_get_tznames(icaltimezone *zone)
Definition icaltimezone.c:1204
icaltimezone * icaltimezone_get_builtin_timezone(const char *location)
Returns a single builtin timezone, given its Olson city name.
Definition icaltimezone.c:1346
const char * icaltimezone_get_location(icaltimezone *zone)
Definition icaltimezone.c:1193
icalarray * icaltimezone_get_builtin_timezones(void)
Returns an icalarray of icaltimezone structs, one for each builtin timezone.
Definition icaltimezone.c:1332
const char * icaltimezone_get_tzid(icaltimezone *zone)
Definition icaltimezone.c:1182
icaltimezone * icaltimezone_get_utc_timezone(void)
Returns the UTC timezone.
Definition icaltimezone.c:1542
void icaltimezone_free(icaltimezone *zone, int free_struct)
Frees all memory used for the icaltimezone.
Definition icaltimezone.c:260
const char * icaltimezone_get_display_name(icaltimezone *zone)
Returns the timezone name to display to the user.
Definition icaltimezone.c:1273
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
double icaltimezone_get_latitude(icaltimezone *zone)
Returns the latitude of a builtin timezone.
Definition icaltimezone.c:1215
icaltimezone * icaltimezone_get_builtin_timezone_from_tzid(const char *tzid)
Returns a single builtin timezone, given its TZID.
Definition icaltimezone.c:1476
void set_zone_directory(const char *path)
Definition icaltimezone.c:2167
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
Definition icalarray.h:36
Definition icaltimezoneimpl.h:23
icalcomponent * component
Definition icaltimezoneimpl.h:49
icalarray * changes
Definition icaltimezoneimpl.h:65
char * location
Definition icaltimezoneimpl.h:30
char * tzid
Definition icaltimezoneimpl.h:24
int end_year
Definition icaltimezoneimpl.h:60
Definition icalcomponent.c:36
Definition icaltime.h:105