scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <time.h>
 2
 3#include "../libc.h"
 4#undef localtime
 5
 6struct tm *
 7localtime(const time_t *timep)
 8{
 9	int dst;
10	time_t t;
11	long off;
12	char *name;
13	struct tm *tm;
14
15	_tzset();
16	t = *timep - _timezone;
17	tm = gmtime(&t);
18
19	if (_isdst(tm)) {
20		dst = 1;
21		off = _dstzone;
22		name = _tzname[1];
23		t = *timep - off;
24		tm = gmtime(&t);
25	} else {
26		dst = 0;
27		off = _timezone;
28		name = _tzname[0];
29	}
30
31	tm->tm_zone = name;
32	tm->tm_isdst = dst;
33	tm->tm_gmtoff = off;
34
35	return tm;
36}