setrlimit setproctitle seteuid setreuid setegid setresgid \
strtoull strtoll strtouq strtoq \
setpriority quotactl getmntent kqueue kevent backtrace_symbols \
- walkcontext dirfd clearenv malloc_usable_size)
+ walkcontext dirfd clearenv malloc_usable_size clock_gettime)
dnl strtoimax and strtoumax are macros in HP-UX, so inttypes.h must be included
AC_MSG_CHECKING([for strtoimax])
#include <ctype.h>
#include <unistd.h>
#include <syslog.h>
+#include <sys/time.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h> /* for strtoimax() and strtoumax() */
#endif
i_panic("my_vsnprintf(): Output string too big");
}
#endif
+
+#ifndef HAVE_CLOCK_GETTIME
+int my_clock_gettime(int clk_id, struct timespec *tp)
+{
+ struct timeval tv;
+
+ i_assert(clk_id == CLOCK_REALTIME);
+
+ /* fallback to using microseconds */
+ if (gettimeofday(&tv, NULL) < 0)
+ return -1;
+ tp->tv_sec = tv.tv_sec;
+ tp->tv_nsec = tv.tv_usec * 1000;
+ return 0;
+}
+#endif
int my_vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif
+#ifndef HAVE_CLOCK_GETTIME
+# include <time.h>
+# undef CLOCK_REALTIME
+# define CLOCK_REALTIME 1
+# define clock_gettime my_clock_gettime
+int my_clock_gettime(int clk_id, struct timespec *tp);
+#endif
+
/* ctype.h isn't safe with signed chars,
use our own instead if really needed */
#define i_toupper(x) ((char) toupper((int) (unsigned char) (x)))