*) AC_CHECK_FUNCS(mkstemp)
;;
esac
-AC_REPLACE_FUNCS(mktime)
+AC_CHECK_FUNCS(mktime)
case "$host" in
*-*-aix4*)
# Just a stub. Idiots.
AC_CHECK_FUNCS(setvbuf sigaction)
AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl)
AC_REPLACE_FUNCS(snprintf strdup strerror strstr)
+AC_CHECK_FUNCS(timegm)
case "$host" in
*-*-aix4*)
# Just stubs. Idiots.
#include "ntp_machine.h"
-#if !HAVE_MKTIME
+#if !HAVE_MKTIME || !HAVE_TIMEGM
#ifndef DSTMINUTES
#define DSTMINUTES 60
static time_t
time2(
struct tm * tmp,
- int * okayp
+ int * okayp,
+ int usezn
)
{
register int dir;
*/
t = (t < 0) ? 0 : ((time_t) 1 << bits);
for ( ; ; ) {
- mytm = *localtime(&t);
+ if (usezn)
+ mytm = *localtime(&t);
+ else
+ mytm = *gmtime(&t);
dir = tmcomp(&mytm, &yourtm);
if (dir != 0) {
if (bits-- < 0)
return WRONG;
}
t += saved_seconds;
- *tmp = *localtime(&t);
+ if (usezn)
+ *tmp = *localtime(&t);
+ else
+ *tmp = *gmtime(&t);
*okayp = TRUE;
return t;
}
+#else
+int mktime_bs;
+#endif /* !HAVE_MKTIME || !HAVE_TIMEGM */
+#if !HAVE_MKTIME
static time_t
time1(
struct tm * tmp
if (tmp->tm_isdst > 1)
tmp->tm_isdst = 1;
- t = time2(tmp, &okay);
+ t = time2(tmp, &okay, 1);
if (okay || tmp->tm_isdst < 0)
return t;
{
return time1(tmp);
}
-#else
-int mktime_bs;
-#endif
+#endif /* !HAVE_MKTIME */
+
+#if !HAVE_TIMEGM
+time_t
+timegm(
+ struct tm * tmp
+ )
+{
+ register time_t t;
+ int okay;
+
+ tmp->tm_isdst = 0;
+ t = time2(tmp, &okay, 0);
+ if (okay || tmp->tm_isdst < 0)
+ return t;
+
+ return WRONG;
+}
+#endif /* !HAVE_TIMEGM */