From af930b27a8a2a88d9629d35094f018eef5c3e417 Mon Sep 17 00:00:00 2001 From: phintuka Date: Fri, 17 Feb 2012 09:15:42 +0000 Subject: moved time_ms() to tools/time_ms.h --- tools/time_ms.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tools/time_ms.h (limited to 'tools') diff --git a/tools/time_ms.h b/tools/time_ms.h new file mode 100644 index 00000000..f49458bb --- /dev/null +++ b/tools/time_ms.h @@ -0,0 +1,29 @@ +/* + * time_ms.h: simple current time interface + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: time_ms.h,v 1.1 2012-02-17 09:15:42 phintuka Exp $ + * + */ + +#ifndef XINELIBOUTPUT_TIME_MS_H_ +#define XINELIBOUTPUT_TIME_MS_H_ + +#include + +static uint64_t time_ms(void) +{ + struct timeval t; + if (gettimeofday(&t, NULL) == 0) + return ((uint64_t)t.tv_sec) * 1000ULL + t.tv_usec / 1000ULL; + return 0; +} + +static uint64_t elapsed(uint64_t t) +{ + return time_ms() - t; +} + +#endif /* XINELIBOUTPUT_TIME_MS_H_ */ -- cgit v1.2.3