1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 09:02:38 +00:00
mpv/Gui/timer.c
arpi 9f6529b3d3 GUI version n-1
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1694 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-08-25 21:04:29 +00:00

38 lines
707 B
C

#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 );
}