xref: /illumos-gate/usr/src/lib/libzoneinfo/common/libzoneinfo.h (revision d2a70789f056fc6c9ce3ab047b52126d80b0e3da)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2001-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_LIBZONEINFO_H
28 #define	_LIBZONEINFO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * WARNING:
34  *
35  * The interfaces defined in this header file are for Sun private use only.
36  * The contents of this file are subject to change without notice for the
37  * future releases.
38  */
39 
40 /*
41  * Declarations for the functions in libzoneinfo
42  */
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 #define	_TZBUFLEN	128		/* timezone name buffer length */
49 #define	_CCBUFLEN	32		/* country code buffer length */
50 
51 #define	_GMT_MAX	(12*60*60)	/* The maximum GMT offset */
52 #define	_GMT_MIN	(-13*60*60)	/* The minimum GMT offset */
53 
54 #define	_VTZ_INSTALL	0		/* zoneinfo or POSIX offset-from-GMT */
55 #define	_VTZ_ALL	1		/* zoneinfo or POSIX */
56 #define	_VTZ_POSIX	2		/* POSIX timezone */
57 #define	_VTZ_ZONEINFO	3		/* zoneinfo timezone */
58 
59 struct tz_timezone {
60 	char tz_name[_TZBUFLEN];	/* timezone name */
61 	char tz_oname[_TZBUFLEN];
62 	char *tz_id_desc;		/* timezone description */
63 	char *tz_display_desc;		/* l10n timezone description */
64 	struct tz_coord {		/* coordinates */
65 		int lat_sign;
66 		unsigned int lat_degree;
67 		unsigned int lat_minute;
68 		unsigned int lat_second;
69 		int long_sign;
70 		unsigned int long_degree;
71 		unsigned int long_minute;
72 		unsigned int long_second;
73 	} tz_coord;
74 	struct tz_timezone *tz_next;	/* pointer to next element */
75 	void *tz_reserved;		/* reserved */
76 };
77 
78 struct tz_continent {
79 	char ctnt_name[_TZBUFLEN];	/* continent name */
80 	char *ctnt_id_desc;		/* continent name (descriptive) */
81 	char *ctnt_display_desc;	/* localized continent name */
82 	struct tz_continent *ctnt_next;	/* pointer to next element */
83 	void *ctnt_reserved;		/* reserved */
84 };
85 
86 struct tz_country {
87 	char ctry_code[_CCBUFLEN];	/* country code */
88 	char *ctry_id_desc;		/* country name (descriptive) */
89 	char *ctry_display_desc;	/* localized country name */
90 	int  ctry_status;		/* private use */
91 	struct tz_country *ctry_next;	/* pointer to next element */
92 	void *ctry_reserved;		/* reserved */
93 };
94 
95 extern int get_tz_continents(struct tz_continent **);
96 extern int get_tz_countries(struct tz_country **, struct tz_continent *);
97 extern int get_timezones_by_country(struct tz_timezone **, struct tz_country *);
98 extern int free_tz_continents(struct tz_continent *);
99 extern int free_tz_countries(struct tz_country *);
100 extern int free_timezones(struct tz_timezone *);
101 extern char *conv_gmt(int, int);
102 extern char *get_system_tz(char *);
103 extern int set_system_tz(char *, char *);
104 extern int isvalid_tz(char *, char *, int);
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif /* _LIBZONEINFO_H */
111