xref: /illumos-gate/usr/src/lib/libzoneinfo/common/libzoneinfo.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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 /*
31  * WARNING:
32  *
33  * The interfaces defined in this header file are for Sun private use only.
34  * The contents of this file are subject to change without notice for the
35  * future releases.
36  */
37 
38 /*
39  * Declarations for the functions in libzoneinfo
40  */
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 #define	_TZBUFLEN	128		/* timezone name buffer length */
47 #define	_CCBUFLEN	32		/* country code buffer length */
48 
49 #define	_GMT_MAX	(12*60*60)	/* The maximum GMT offset */
50 #define	_GMT_MIN	(-13*60*60)	/* The minimum GMT offset */
51 
52 #define	_VTZ_INSTALL	0		/* zoneinfo or POSIX offset-from-GMT */
53 #define	_VTZ_ALL	1		/* zoneinfo or POSIX */
54 #define	_VTZ_POSIX	2		/* POSIX timezone */
55 #define	_VTZ_ZONEINFO	3		/* zoneinfo timezone */
56 
57 struct tz_timezone {
58 	char tz_name[_TZBUFLEN];	/* timezone name */
59 	char tz_oname[_TZBUFLEN];
60 	char *tz_id_desc;		/* timezone description */
61 	char *tz_display_desc;		/* l10n timezone description */
62 	struct tz_coord {		/* coordinates */
63 		int lat_sign;
64 		unsigned int lat_degree;
65 		unsigned int lat_minute;
66 		unsigned int lat_second;
67 		int long_sign;
68 		unsigned int long_degree;
69 		unsigned int long_minute;
70 		unsigned int long_second;
71 	} tz_coord;
72 	struct tz_timezone *tz_next;	/* pointer to next element */
73 	void *tz_reserved;		/* reserved */
74 };
75 
76 struct tz_continent {
77 	char ctnt_name[_TZBUFLEN];	/* continent name */
78 	char *ctnt_id_desc;		/* continent name (descriptive) */
79 	char *ctnt_display_desc;	/* localized continent name */
80 	struct tz_continent *ctnt_next;	/* pointer to next element */
81 	void *ctnt_reserved;		/* reserved */
82 };
83 
84 struct tz_country {
85 	char ctry_code[_CCBUFLEN];	/* country code */
86 	char *ctry_id_desc;		/* country name (descriptive) */
87 	char *ctry_display_desc;	/* localized country name */
88 	int  ctry_status;		/* private use */
89 	struct tz_country *ctry_next;	/* pointer to next element */
90 	void *ctry_reserved;		/* reserved */
91 };
92 
93 extern int get_tz_continents(struct tz_continent **);
94 extern int get_tz_countries(struct tz_country **, struct tz_continent *);
95 extern int get_timezones_by_country(struct tz_timezone **, struct tz_country *);
96 extern int free_tz_continents(struct tz_continent *);
97 extern int free_tz_countries(struct tz_country *);
98 extern int free_timezones(struct tz_timezone *);
99 extern char *conv_gmt(int, int);
100 extern char *get_system_tz(char *);
101 extern int set_system_tz(char *, char *);
102 extern int isvalid_tz(char *, char *, int);
103 
104 #ifdef	__cplusplus
105 }
106 #endif
107 
108 #endif /* _LIBZONEINFO_H */
109