1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
27 * time conversion support
34 * return timezone pointer given name and type
36 * if type==0 then all time zone types match
37 * otherwise type must be one of tm_info.zone[].type
39 * if end is non-null then it will point to the next
40 * unmatched char in name
42 * if dst!=0 then it will point to 0 for standard zones
43 * and the offset for daylight zones
45 * 0 returned for no match
49 tmzone(register const char* name
, char** end
, const char* type
, int* dst
)
51 register Tm_zone_t
* zp
;
55 static Tm_zone_t fixed
;
59 if ((*name
== '+' || *name
== '-') && (fixed
.west
= tmgoff(name
, &e
, TM_LOCALZONE
)) != TM_LOCALZONE
&& !*e
)
61 fixed
.standard
= fixed
.daylight
= strncpy(off
, name
, sizeof(off
) - 1);
74 if (!type
|| type
== prev
|| !prev
)
76 if (tmword(name
, end
, zp
->standard
, NiL
, 0))
82 if (zp
->dst
&& zp
->daylight
&& tmword(name
, end
, zp
->daylight
, NiL
, 0))
89 if (zp
== tm_info
.local
)
93 } while (zp
->standard
);