Skip to content

Commit

Permalink
Move get_time() function to a new utils.c
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxstb committed Jul 5, 2013
1 parent f5ed93c commit 9a372f8
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 13 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -48,6 +48,7 @@ SRCS = \
omx_utils.c \
osd.c \
tiresias_pcfont.c \
utils.c \
vcodec_omx.c \
vo_pi.c

Expand Down
14 changes: 1 addition & 13 deletions osd.c
Expand Up @@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "channels.h"
#include "events.h"
#include "codec.h"
#include "utils.h"

#define SCREEN 0
#define BG_LAYER 0
Expand All @@ -57,19 +58,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define CHANNELLIST_UP 1
#define CHANNELLIST_DOWN 2

double get_time(void)
{
struct timeval tv;

gettimeofday(&tv,NULL);

double x = tv.tv_sec;
x *= 1000;
x += tv.tv_usec / 1000;

return x;
}

static void utf8decode(char* str, char* r)
{
int x,y,z,ud;
Expand Down
38 changes: 38 additions & 0 deletions utils.c
@@ -0,0 +1,38 @@
/*
pidvbip - tvheadend client for the Raspberry Pi
(C) Dave Chapman 2012-2013
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <sys/time.h>
#include <string.h>

double get_time(void)
{
struct timeval tv;

gettimeofday(&tv,NULL);

double x = tv.tv_sec;
x *= 1000;
x += tv.tv_usec / 1000;

return x;
}

28 changes: 28 additions & 0 deletions utils.h
@@ -0,0 +1,28 @@
/*
pidvbip - tvheadend client for the Raspberry Pi
(C) Dave Chapman 2012-2013
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _UTILS_H
#define _UTILS_H

double get_time(void); /* Get time of day in ms */

#endif

0 comments on commit 9a372f8

Please sign in to comment.