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
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.
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]
23 * Copyright 1986 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
28 /* from UCB 4.4 83/09/25 */
31 * The arguments are the number of minutes of time
32 * you are westward from Greenwich and whether DST is in effect.
34 * giving the name of the local timezone.
36 * Sorry, I don't know all the names.
44 -12*60, "NZST", "NZDT", /* New Zealand */
45 -10*60, "EST", "EST", /* Aust: Eastern */
46 -10*60+30, "CST", "CST", /* Aust: Central */
47 -8*60, "WST", 0, /* Aust: Western */
48 -9*60, "JST", 0, /* Japanese */
49 0*60, "GMT", "BST", /* Great Britain and Eire */
50 -1*60, "MET", "MET DST", /* Middle European */
51 -2*60, "EET", "EET DST", /* Eastern European */
52 3*60+30, "NST", "NDT", /* Newfoundland */
53 4*60, "AST", "ADT", /* Atlantic */
54 5*60, "EST", "EDT", /* Eastern */
55 6*60, "CST", "CDT", /* Central */
56 7*60, "MST", "MDT", /* Mountain */
57 8*60, "PST", "PDT", /* Pacific */
58 9*60, "YST", "YDT", /* Yukon */
59 10*60, "HST", "HDT", /* Hawaiian */
63 char *timezone(zone
, dst
)
65 register struct zone
*zp
;
66 static char czone
[10];
69 char *getenv(), *index();
71 if (p
= getenv("TZNAME")) {
72 if (q
= index(p
, ',')) {
77 strncpy(czone
, p
, sizeof(czone
)-1);
78 czone
[sizeof(czone
)-1] = '\0';
85 for (zp
=zonetab
; zp
->offset
!=-1; zp
++)
86 if (zp
->offset
==zone
) {
87 if (dst
&& zp
->dlzone
)
89 if (!dst
&& zp
->stdzone
)
97 sprintf(czone
, "GMT%s%d:%02d", sign
, zone
/60, zone
%60);