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 +++++++++++++++++++++++++++++ xine_frontend_lirc.c | 17 +++-------------- 2 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 tools/time_ms.h 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_ */ diff --git a/xine_frontend_lirc.c b/xine_frontend_lirc.c index bdb11c64..db33fd5e 100644 --- a/xine_frontend_lirc.c +++ b/xine_frontend_lirc.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_frontend_lirc.c,v 1.26 2011-02-28 13:42:42 phintuka Exp $ + * $Id: xine_frontend_lirc.c,v 1.27 2012-02-17 09:15:41 phintuka Exp $ * */ /* @@ -35,6 +35,8 @@ #include #include +#include "tools/time_ms.h" + #define LOG_MODULENAME "[lirc] " #include "logdefs.h" @@ -60,19 +62,6 @@ static int lirc_repeat_emu = 0; /* xine_frontend_main.c: */ extern int gui_hotkeys; -static uint64_t time_ms() -{ - 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; -} - static void lircd_connect(void) { struct sockaddr_un addr; -- cgit v1.2.3