#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE)
#include <time.h> /* timeval */
#include <unistd.h> /* usleep */
#endif
+#if defined(PIPE_OS_HAIKU)
+#include <sys/time.h> /* timeval */
+#include <unistd.h>
+#endif
+
#include "pipe/p_compiler.h"
*/
struct util_time
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
struct timeval tv;
#else
int64_t counter;
void
util_time_get(struct util_time *t);
+/**
+ * Return t2 = t1 + usecs
+ */
void
util_time_add(const struct util_time *t1,
int64_t usecs,
struct util_time *t2);
+/**
+ * Return current time in microseconds
+ */
uint64_t
util_time_micros( void );
+/**
+ * Return difference between times, in microseconds
+ */
int64_t
util_time_diff(const struct util_time *t1,
const struct util_time *t2);
const struct util_time *end,
const struct util_time *curr);
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
#define util_time_sleep usleep
#else
void