source: trunk/essentials/sys-apps/gawk/missing_d/tzset.c

Last change on this file was 3076, checked in by bird, 18 years ago

gawk 3.1.5

File size: 681 bytes
Line 
1/*
2 * tzset.c
3 *
4 * Quick and dirty emulation of tzset(), tzname[], and daylight
5 * for old BSD systems without it.
6 *
7 * Thanks to Rick Adams, rick@uunet.uu.net, for the basics.
8 *
9 * BUGS:
10 * Totally ignores the value of the TZ environment variable.
11 */
12
13#if 0
14#include <time.h>
15#endif
16#include <sys/time.h>
17
18static char tz1[1024];
19static char tz2[1024];
20
21/* external variables */
22char *tzname[2] = {
23 tz1, tz2
24};
25int daylight;
26
27extern char *timezone();
28
29void
30tzset()
31{
32 struct timeval tp;
33 struct timezone tz;
34
35 (void) gettimeofday(&tp, &tz);
36 (void) strcpy(tz1, timezone(tz.tz_minuteswest, 0));
37 (void) strcpy(tz2, timezone(tz.tz_minuteswest, 1));
38 daylight = tz.tz_dsttime;
39}
Note: See TracBrowser for help on using the repository browser.