if_iwm - Factor out firmware station handling into if_iwm_sta.c.
[dragonfly.git] / contrib / ldns / compat / timegm.c
blob97e1e5443664b87747a63eacfc53277b38c0a050
1 #ifdef HAVE_CONFIG_H
2 #include <ldns/config.h>
3 #endif
5 #include <stdio.h>
7 #ifdef HAVE_STDLIB_H
8 #include <stdlib.h>
9 #endif
11 #include <time.h>
13 time_t
14 timegm (struct tm *tm) {
15 time_t ret;
16 char *tz;
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);
27 else
28 putenv((char*)"TZ");
29 tzset();
30 return ret;