1 #ifdef HAVE_CONFIG_H 2 #include <ldns/config.h> 3 #endif 4 5 #include <stdio.h> 6 7 #ifdef HAVE_STDLIB_H 8 #include <stdlib.h> 9 #endif 10 11 #include <time.h> 12 13 time_t 14 timegm (struct tm *tm) { 15 time_t ret; 16 char *tz; 17 18 tz = getenv("TZ"); 19 putenv((char*)"TZ="); 20 tzset(); 21 ret = mktime(tm); 22 if (tz) { 23 char buf[256]; 24 snprintf(buf, sizeof(buf), "TZ=%s", tz); 25 putenv(tz); 26 } 27 else 28 putenv((char*)"TZ"); 29 tzset(); 30 return ret; 31 } 32