summaryrefslogtreecommitdiff
path: root/libc/misc/time/localtime.c
blob: cdfd9bde344c0599dcffddb584b3bf93c1bcbc2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include <time.h>
#include <sys/time.h>

/* These globals are exported by the C library */
char *__tzname[2] = { (char *) "GMT", (char *) "GMT" };
int __daylight = 0;
long int __timezone = 0L;
weak_alias (__tzname, tzname);
weak_alias (__daylight, daylight);
weak_alias (__timezone, timezone);


extern void __tm_conv();

struct tm *localtime(timep)
__const time_t *timep;
{
	static struct tm tmb;
	struct timezone tz;
	time_t offt;

	gettimeofday((void *) 0, &tz);

	offt = -tz.tz_minuteswest * 60L;

	/* tmb.tm_isdst = ? */
	__tm_conv(&tmb, timep, offt);

	return &tmb;
}