ape: implement altzone for tzset()

This commit is contained in:
cinap_lenrek 2015-08-04 02:01:41 +02:00
parent 333812ca38
commit 63759d2efb
2 changed files with 5 additions and 0 deletions

View file

@ -67,6 +67,7 @@ extern int nanosleep(const struct timespec *req, struct timespec *rem);
#ifdef _POSIX_SOURCE #ifdef _POSIX_SOURCE
extern char *tzname[2]; extern char *tzname[2];
extern long timezone; extern long timezone;
extern long altzone;
extern int daylight; extern int daylight;
#endif #endif

View file

@ -12,6 +12,7 @@ char *tzname[2] = {
std, dst std, dst
}; };
long timezone; long timezone;
long altzone;
int daylight; int daylight;
void void
@ -38,6 +39,7 @@ tzset(void)
*p = 0; *p = 0;
strncpy(dst, q, sizeof dst); strncpy(dst, q, sizeof dst);
q = p + 1; q = p + 1;
altzone = - atoi(q);
daylight = 1; daylight = 1;
free(env); free(env);
return; return;
@ -46,6 +48,7 @@ error:
strcpy(std, "GMT0"); strcpy(std, "GMT0");
dst[0] = '\0'; dst[0] = '\0';
timezone = 0; timezone = 0;
altzone = 0;
daylight = 0; daylight = 0;
if(env != 0) if(env != 0)
free(env); free(env);
@ -54,6 +57,7 @@ error:
nodst: nodst:
dst[0] = '\0'; dst[0] = '\0';
daylight = 0; daylight = 0;
altzone = timezone;
free(env); free(env);
return; return;
} }