wip
This commit is contained in:
parent
5d045fa8b4
commit
934b28aa1f
@ -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
|
||||
|
28
src/irmc.c
28
src/irmc.c
@ -17,7 +17,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user