view Gui/timer.c @ 2743:1438574ccdc3

dvb test, /dev/ost/video: Check for character device (-c) instead of file existance (-e), the -e test is not available on solaris' /bin/sh.
author jkeil
date Tue, 06 Nov 2001 16:56:27 +0000
parents d237c5d4b216
children
line wrap: on
line source


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

#include "timer.h"

static struct itimerval it;
static struct sigaction sa;

timerTSigHandler timerSigHandler;

void timerSetHandler( timerTSigHandler handler )
{ timerSigHandler=handler; }

void timerInit( void )
{
 sa.sa_handler=timerSigHandler;
 sa.sa_flags=SA_RESTART;
 sigemptyset( &sa.sa_mask );
 sigaction( SIGALRM,&sa,NULL );
 it.it_interval.tv_sec=0;
 it.it_interval.tv_usec=20000;
 it.it_value.tv_sec=0;
 it.it_value.tv_usec=50000;
 setitimer( ITIMER_REAL,&it,NULL );
}

void timerDone( void )
{
 it.it_interval.tv_sec=0;
 it.it_interval.tv_usec=0;
 it.it_value.tv_sec=0;
 it.it_value.tv_usec=0;
 setitimer( ITIMER_REAL,&it,NULL );
}