timezone.c (165903) | timezone.c (200150) |
---|---|
1/* 2 * Copyright (c) 1987, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)timezone.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1987, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)timezone.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/lib/libc/gen/timezone.c 165903 2007-01-09 00:28:16Z imp $"); | 34__FBSDID("$FreeBSD: head/lib/libc/gen/timezone.c 200150 2009-12-05 19:31:38Z ed $"); |
35 36#include <sys/types.h> 37#include <sys/time.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> 41#define TZ_MAX_CHARS 255 42 | 35 36#include <sys/types.h> 37#include <sys/time.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> 41#define TZ_MAX_CHARS 255 42 |
43char *_tztab(); | 43char *_tztab(int, int); |
44 45/* 46 * timezone -- 47 * The arguments are the number of minutes of time you are westward 48 * from Greenwich and whether DST is in effect. It returns a string 49 * giving the name of the local timezone. Should be replaced, in the 50 * application code, by a call to localtime. 51 */ 52 53static char czone[TZ_MAX_CHARS]; /* space for zone name */ 54 55char * | 44 45/* 46 * timezone -- 47 * The arguments are the number of minutes of time you are westward 48 * from Greenwich and whether DST is in effect. It returns a string 49 * giving the name of the local timezone. Should be replaced, in the 50 * application code, by a call to localtime. 51 */ 52 53static char czone[TZ_MAX_CHARS]; /* space for zone name */ 54 55char * |
56timezone(zone, dst) 57 int zone, 58 dst; | 56timezone(int zone, int dst) |
59{ 60 char *beg, 61 *end; 62 63 if ( (beg = getenv("TZNAME")) ) { /* set in environment */ 64 if ( (end = index(beg, ',')) ) {/* "PST,PDT" */ 65 if (dst) 66 return(++end); --- 34 unchanged lines hidden (view full) --- 101/* 102 * _tztab -- 103 * check static tables or create a new zone name; broken out so that 104 * we can make a guess as to what the zone is if the standard tables 105 * aren't in place in /etc. DO NOT USE THIS ROUTINE OUTSIDE OF THE 106 * STANDARD LIBRARY. 107 */ 108char * | 57{ 58 char *beg, 59 *end; 60 61 if ( (beg = getenv("TZNAME")) ) { /* set in environment */ 62 if ( (end = index(beg, ',')) ) {/* "PST,PDT" */ 63 if (dst) 64 return(++end); --- 34 unchanged lines hidden (view full) --- 99/* 100 * _tztab -- 101 * check static tables or create a new zone name; broken out so that 102 * we can make a guess as to what the zone is if the standard tables 103 * aren't in place in /etc. DO NOT USE THIS ROUTINE OUTSIDE OF THE 104 * STANDARD LIBRARY. 105 */ 106char * |
109_tztab(zone,dst) 110 int zone; 111 int dst; | 107_tztab(int zone, int dst) |
112{ 113 struct zone *zp; 114 char sign; 115 116 for (zp = zonetab; zp->offset != -1;++zp) /* static tables */ 117 if (zp->offset == zone) { 118 if (dst && zp->dlzone) 119 return(zp->dlzone); --- 14 unchanged lines hidden --- | 108{ 109 struct zone *zp; 110 char sign; 111 112 for (zp = zonetab; zp->offset != -1;++zp) /* static tables */ 113 if (zp->offset == zone) { 114 if (dst && zp->dlzone) 115 return(zp->dlzone); --- 14 unchanged lines hidden --- |