portability


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@104 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c
index f17b439..4d1b390 100644
--- a/skeletons/GeneralizedTime.c
+++ b/skeletons/GeneralizedTime.c
@@ -36,15 +36,19 @@
 static time_t timegm(struct tm *tm) {
 	time_t tloc;
 	char *tz;
+	char *buf;
 
 	tz = getenv("TZ");
-	setenv("TZ", "", 1);
+         _putenv("TZ=UTC");
 	tzset();
 	tloc = mktime(tm);
-	if (tz)
-		setenv("TZ", tz, 1);
-	else
-		unsetenv("TZ");
+	if (tz) {
+		buf = alloca(strlen(tz) + 4);
+		sprintf(buf, "TZ=%s", tz);
+	} else {
+		buf = "TZ=";
+	}
+	_putenv(buf);
 	tzset();
 	return tloc;
 }