It should be more efficient than repeatedly calling gmtime() many times.
getmntinfo setpriority quotactl getmntent kqueue kevent \
backtrace_symbols walkcontext dirfd clearenv \
malloc_usable_size glob fallocate posix_fadvise \
- getpeereid getpeerucred inotify_init)
+ getpeereid getpeerucred inotify_init timegm)
AC_CHECK_TYPES([struct sockpeercred],,,[
#include <sys/types.h>
return tm1->tm_sec - tm2->tm_sec;
}
+#ifdef HAVE_TIMEGM
+time_t utc_mktime(const struct tm *tm)
+{
+ struct tm mod_tm = *tm;
+ time_t t;
+
+ t = timegm(&mod_tm);
+ if (tm_cmp(tm, &mod_tm) != 0)
+ return (time_t)-1;
+ return t;
+}
+#else
time_t utc_mktime(const struct tm *tm)
{
const struct tm *try_tm;
return (time_t)-1;
}
+#endif