static void smi_free(void *ptr) { #if (SMI_VERSION_MAJOR >= 0) && (SMI_VERSION_MINOR >= 4) && (SMI_VERSION_PATCHLEVEL >= 8) smiFree(ptr); #else #ifdef _WIN32 #error Invalid Windows libsmi version ?? !! #endif #define xx_free free /* hack so checkAPIs.pl doesn't complain */ xx_free(ptr); #endif }
time_t timegm(struct tm *tm) { char *tz; static char *s = NULL; char *tofree = NULL; time_t t; /* ensure to call mktime() for UTC */ tz = getenv("TZ"); if (tz) { tofree = s; smiAsprintf(&s, "TZ=%s", tz); } putenv("TZ=NULL"); t = mktime(tm); if (tz) { putenv(s); } else { putenv("TZ="); } if (tofree) smiFree(tofree); return t; }