From 934b28aa1f21b426cd36390072c81f220fd6d8fe Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Tue, 4 Oct 2016 16:24:34 +0200 Subject: [PATCH] wip --- src/Makefile | 2 +- src/irmc.c | 28 +--------------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/Makefile b/src/Makefile index 97cff7a..59db792 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,4 @@ -SRC = irmc.c cwprotocol.c beep.c +SRC = util.c irmc.c cwprotocol.c beep.c OBJ = ${SRC:.c=.o} LDFLAGS = -lportaudio -lpthread -lm CFLAGS = -Wall -Wno-format-zero-length -Wno-unused-function diff --git a/src/irmc.c b/src/irmc.c index f1a2fbe..fbaf600 100644 --- a/src/irmc.c +++ b/src/irmc.c @@ -17,7 +17,6 @@ #include #include #include -#include // raspi wiring: http://raspberrypiguide.de/howtos/raspberry-pi-gpio-how-to/ @@ -41,6 +40,7 @@ #include "cwprotocol.h" #include "beep.h" +#include "util.h" int serial_status = 0, fd_serial, numbytes; @@ -64,32 +64,6 @@ char last_sender[16]; int translate = 1; int audio_status = 1; -/* portable time, as listed in https://gist.github.com/jbenet/1087739 */ -void current_utc_time(struct timespec *ts) { -#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - ts->tv_sec = mts.tv_sec; - ts->tv_nsec = mts.tv_nsec; -#else - clock_gettime(CLOCK_REALTIME, ts); -#endif -} - -/* a better clock() in milliseconds */ -long fastclock(void) -{ - struct timespec t; - long r; - - current_utc_time (&t); - r = t.tv_sec * 1000; - r = r + t.tv_nsec / 1000000; - return r; -} int kbhit (void) {