Libical API Documentation 4.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 SPDX-FileCopyrightText: 2001, Damon Chaplin <damon@ximian.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
8
9======================================================================*/
14
15#ifndef ICALTIMEZONE_H
16#define ICALTIMEZONE_H
17
18#include "libical_ical_export.h"
19#include "icalcomponent.h"
20
21#include <stdbool.h>
22#include <stdio.h>
23
24#if !defined(ICALTIMEZONE_DEFINED)
25#define ICALTIMEZONE_DEFINED
29typedef struct _icaltimezone icaltimezone;
30#endif
31
32/*
33 * Creating/Destroying individual icaltimezones.
34 */
35
37LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_new(void);
38
39LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_copy(icaltimezone *originalzone);
40
45LIBICAL_ICAL_EXPORT void icaltimezone_free(icaltimezone *zone, int free_struct);
46
52LIBICAL_ICAL_EXPORT void icaltimezone_set_tzid_prefix(const char *new_prefix);
53
54/*
55 * Accessing timezones.
56 */
57
59LIBICAL_ICAL_EXPORT void icaltimezone_free_builtin_timezones(void);
60
68LIBICAL_ICAL_EXPORT icalarray *icaltimezone_get_builtin_timezones(void);
69
71LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_get_builtin_timezone(const char *location);
72
75 const char *tzname);
76
78LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_get_builtin_timezone_from_tzid(const char *tzid);
79
81LIBICAL_ICAL_EXPORT icaltimezone *icaltimezone_get_utc_timezone(void);
82
84LIBICAL_ICAL_EXPORT const char *icaltimezone_get_tzid(icaltimezone *zone);
85
87LIBICAL_ICAL_EXPORT const char *icaltimezone_get_location(icaltimezone *zone);
88
93LIBICAL_ICAL_EXPORT const char *icaltimezone_get_tznames(icaltimezone *zone);
94
96LIBICAL_ICAL_EXPORT double icaltimezone_get_latitude(icaltimezone *zone);
97
99LIBICAL_ICAL_EXPORT double icaltimezone_get_longitude(icaltimezone *zone);
100
102LIBICAL_ICAL_EXPORT icalcomponent *icaltimezone_get_component(icaltimezone *zone);
103
109LIBICAL_ICAL_EXPORT int icaltimezone_set_component(icaltimezone *zone, icalcomponent *comp);
110
117LIBICAL_ICAL_EXPORT const char *icaltimezone_get_display_name(icaltimezone *zone);
118
119/*
120 * Converting times between timezones.
121 */
122
123LIBICAL_ICAL_EXPORT void icaltimezone_convert_time(struct icaltimetype *tt,
124 icaltimezone *from_zone,
125 icaltimezone *to_zone);
126
127/*
128 * Getting offsets from UTC.
129 */
130
137LIBICAL_ICAL_EXPORT int icaltimezone_get_utc_offset(icaltimezone *zone,
138 struct icaltimetype *tt, int *is_daylight);
139
145LIBICAL_ICAL_EXPORT int icaltimezone_get_utc_offset_of_utc_time(icaltimezone *zone,
146 struct icaltimetype *tt,
147 int *is_daylight);
148
149/*
150 * Handling arrays of timezones. Mainly for internal use.
151 */
152LIBICAL_ICAL_EXPORT icalarray *icaltimezone_array_new(void);
153
154LIBICAL_ICAL_EXPORT void icaltimezone_array_append_from_vtimezone(icalarray *timezones,
155 icalcomponent *child);
156
157LIBICAL_ICAL_EXPORT void icaltimezone_array_free(icalarray *timezones);
158
159/*
160 * By request (issue #112) make vtimezone functions public
161 */
162LIBICAL_ICAL_EXPORT void icaltimezone_expand_vtimezone(icalcomponent *comp,
164
166LIBICAL_ICAL_EXPORT char *icaltimezone_get_location_from_vtimezone(icalcomponent *component);
167
174LIBICAL_ICAL_EXPORT char *icaltimezone_get_tznames_from_vtimezone(icalcomponent *component);
175
176/*
177 * Truncate a VTIMEZONE component to the given start and end times.
178 * If either time is null, then no truncation will occur at that point.
179 * If either time is non-null, then it MUST be specified as UTC.
180 * If the start time is non-null and ms_compatible is zero,
181 * then the DTSTART of RRULEs will be adjusted to occur after the start time.
182 * @since 3.0.6
183 */
184LIBICAL_ICAL_EXPORT void icaltimezone_truncate_vtimezone(icalcomponent *vtz,
185 icaltimetype start,
186 icaltimetype end,
187 int ms_compatible);
188
189/*
190 * @par Handling the default location the timezone files
191 */
192
194LIBICAL_ICAL_EXPORT const char *get_zone_directory(void);
195
197LIBICAL_ICAL_EXPORT void set_zone_directory(const char *path);
198
200LIBICAL_ICAL_EXPORT void free_zone_directory(void);
201
202LIBICAL_ICAL_EXPORT void icaltimezone_release_zone_tab(void);
203
204/*
205 * @par Handling whether to use builtin timezone files
206 */
207LIBICAL_ICAL_EXPORT void icaltimezone_set_builtin_tzdata(bool set);
208
209LIBICAL_ICAL_EXPORT bool icaltimezone_get_builtin_tzdata(void);
210
211/*
212 * Debugging Output.
213 */
214
232LIBICAL_ICAL_EXPORT bool icaltimezone_dump_changes(icaltimezone *zone, int max_year, FILE *fp);
233
234/* For the library only -- do not make visible */
235extern const char *icaltimezone_tzid_prefix(void);
236
237#endif /* ICALTIMEZONE_H */
struct _icalarray icalarray
A struct representing an icalarray object.
Definition icalarray.h:28
struct _icaltimezone icaltimezone
An opaque struct representing a timezone. We declare this here to avoid a circular dependency.
Definition icaltime.h:84
icaltimezone * icaltimezone_new(void)
Creates a new icaltimezone.
Definition icaltimezone.c:201
void icaltimezone_set_tzid_prefix(const char *new_prefix)
Definition icaltimezone.c:2167
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:1441
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:813
double icaltimezone_get_longitude(icaltimezone *zone)
Returns the longitude of a builtin timezone.
Definition icaltimezone.c:1222
void free_zone_directory(void)
Definition icaltimezone.c:2159
char * icaltimezone_get_location_from_vtimezone(icalcomponent *component)
Gets the LOCATION or X-LIC-LOCATION property from a VTIMEZONE.
Definition icaltimezone.c:344
char * icaltimezone_get_tznames_from_vtimezone(icalcomponent *component)
Gets the TZNAMEs used for the last STANDARD & DAYLIGHT components in a VTIMEZONE.
Definition icaltimezone.c:371
const char * get_zone_directory(void)
Definition icaltimezone.c:2139
icalcomponent * icaltimezone_get_component(icaltimezone *zone)
Returns the VTIMEZONE component of a timezone.
Definition icaltimezone.c:1233
void icaltimezone_free_builtin_timezones(void)
Releases builtin timezone memory.
Definition icaltimezone.c:1336
const char * icaltimezone_get_tznames(icaltimezone *zone)
Definition icaltimezone.c:1200
icaltimezone * icaltimezone_get_builtin_timezone(const char *location)
Returns a single builtin timezone, given its Olson city name.
Definition icaltimezone.c:1342
const char * icaltimezone_get_location(icaltimezone *zone)
Definition icaltimezone.c:1189
icalarray * icaltimezone_get_builtin_timezones(void)
Returns an icalarray of icaltimezone structs, one for each builtin timezone.
Definition icaltimezone.c:1328
const char * icaltimezone_get_tzid(icaltimezone *zone)
Definition icaltimezone.c:1178
icaltimezone * icaltimezone_get_utc_timezone(void)
Returns the UTC timezone.
Definition icaltimezone.c:1538
void icaltimezone_free(icaltimezone *zone, int free_struct)
Frees all memory used for the icaltimezone.
Definition icaltimezone.c:250
const char * icaltimezone_get_display_name(icaltimezone *zone)
Returns the timezone name to display to the user.
Definition icaltimezone.c:1269
int icaltimezone_set_component(icaltimezone *zone, icalcomponent *comp)
Sets the VTIMEZONE component of an icaltimezone, initializing the tzid, location & tzname fields.
Definition icaltimezone.c:1244
double icaltimezone_get_latitude(icaltimezone *zone)
Returns the latitude of a builtin timezone.
Definition icaltimezone.c:1211
icaltimezone * icaltimezone_get_builtin_timezone_from_tzid(const char *tzid)
Returns a single builtin timezone, given its TZID.
Definition icaltimezone.c:1472
bool 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:1924
void set_zone_directory(const char *path)
Definition icaltimezone.c:2148
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:971
Definition icaltimezoneimpl.h:14
icalcomponent * component
Definition icaltimezoneimpl.h:40
icalarray * changes
Definition icaltimezoneimpl.h:56
char * location
Definition icaltimezoneimpl.h:21
char * tzid
Definition icaltimezoneimpl.h:15
int end_year
Definition icaltimezoneimpl.h:51
Definition icaltime.h:98