Tweaks to build properly on Linux.

This commit is contained in:
rsc 2003-11-24 00:43:41 +00:00
parent 478ee9636f
commit d2c4ee9e48
9 changed files with 70 additions and 26 deletions

View file

@ -1,3 +1,5 @@
#include <stdlib.h> /* setenv etc. */
#include <u.h>
#include <libc.h>
@ -72,11 +74,22 @@ p9localtime(long t)
return &bigtm;
}
#if !defined(_HAVETIMEGM) && defined(_HAVETIMEZONEINT)
static long
#if !defined(_HAVETIMEGM)
static time_t
timegm(struct tm *tm)
{
return mktime(tm)-timezone;
time_t ret;
char *tz;
tz = getenv("TZ");
setenv("TZ", "", 1);
tzset();
ret = mktime(tm);
if(tz)
setenv("TZ", tz, 1);
else
unsetenv("TZ");
return ret;
}
#endif