diff options
| author | phintuka <phintuka> | 2012-02-17 09:15:42 +0000 |
|---|---|---|
| committer | phintuka <phintuka> | 2012-02-17 09:15:42 +0000 |
| commit | af930b27a8a2a88d9629d35094f018eef5c3e417 (patch) | |
| tree | f37e3642b52beda82fdf7df02a27b1ccf3450e2b | |
| parent | 693a9595e145d39b3375a39733331924455941c7 (diff) | |
| download | xineliboutput-af930b27a8a2a88d9629d35094f018eef5c3e417.tar.gz xineliboutput-af930b27a8a2a88d9629d35094f018eef5c3e417.tar.bz2 | |
moved time_ms() to tools/time_ms.h
| -rw-r--r-- | tools/time_ms.h | 29 | ||||
| -rw-r--r-- | xine_frontend_lirc.c | 17 |
2 files changed, 32 insertions, 14 deletions
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 <sys/time.h> + +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 <sys/socket.h> #include <sys/un.h> +#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; |
