spandsp 0.0.6

private/timezone.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/timezone.h - Timezone handling for time interpretation
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2010 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#if !defined(_SPANDSP_PRIVATE_TIMEZONE_H_)
27#define _SPANDSP_PRIVATE_TIMEZONE_H_
28
29#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
30
31#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
32
33#define TZNAME_MAX 255
34
35/* The TZ_MAX_TIMES value below is enough to handle a bit more than a
36 * year's worth of solar time (corrected daily to the nearest second) or
37 * 138 years of Pacific Presidential Election time
38 * (where there are three time zone transitions every fourth year). */
39#define TZ_MAX_TIMES 370
40
41#if !defined(NOSOLAR)
42#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
43#else
44/* Must be at least 14 for Europe/Riga as of Jan 12 1995,
45 * as noted by Earl Chew <earl@hpato.aus.hp.com>. */
46#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
47#endif
48
49#define TZ_BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
50
51/* Time type information */
52 struct tz_ttinfo_s
53{
54 int32_t gmtoff; /* UTC offset in seconds */
55 int isdst; /* Used to set tm_isdst */
56 int abbrind; /* Abbreviation list index */
57 int ttisstd; /* TRUE if transition is std time */
58 int ttisgmt; /* TRUE if transition is UTC */
59};
60
61/* Leap second information */
62 struct tz_lsinfo_s
63{
64 time_t trans; /* Transition time */
65 int32_t corr; /* Correction to apply */
66};
67
68 struct tz_state_s
69{
70 int leapcnt;
71 int timecnt;
72 int typecnt;
73 int charcnt;
74 time_t ats[TZ_MAX_TIMES];
75 uint8_t types[TZ_MAX_TIMES];
76 struct tz_ttinfo_s ttis[TZ_MAX_TYPES];
77 char chars[TZ_BIGGEST(TZ_MAX_CHARS + 1, (2*(TZNAME_MAX + 1)))];
78 struct tz_lsinfo_s lsis[TZ_MAX_LEAPS];
79};
80
81 struct tz_s
82{
83 struct tz_state_s state;
84 char lcl_tzname[TZNAME_MAX + 1];
85 int lcl_is_set;
86 const char *tzname[2];
87};
88
89#endif
90/*- End of file ------------------------------------------------------------*/
tz_lsinfo_s
Definition private/timezone.h:63
tz_s
Definition private/timezone.h:82
tz_state_s
Definition private/timezone.h:69
tz_ttinfo_s
Definition private/timezone.h:53