~vcs-imports/gawk/master

« back to all changes in this revision

Viewing changes to missing/tzset.c

  • Committer: Arnold D. Robbins
  • Date: 2010-07-16 10:09:56 UTC
  • Revision ID: git-v1:bc70de7b3302d5a81515b901cae376b8b51d2004
Tags: gawk-3.1.0
Move to gawk-3.1.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
18
 
static char tz1[1024];
19
 
static char tz2[1024];
20
 
 
21
 
/* external variables */
22
 
char *tzname[2] = {
23
 
        tz1, tz2
24
 
};
25
 
int daylight;
26
 
 
27
 
extern char *timezone();
28
 
 
29
 
void
30
 
tzset()
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
 
}