diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-08-25 21:04:29 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-08-25 21:04:29 +0000 |
commit | 9f6529b3d3a1ec681a84735d57a9f2d8656809af (patch) | |
tree | 4943e4a95c68932a956ce7a693c58f5b2ed79b37 /Gui/timer.c | |
parent | 05f7ab93841eef7bf50c31b64bf723c100e0c123 (diff) | |
download | mpv-9f6529b3d3a1ec681a84735d57a9f2d8656809af.tar.bz2 mpv-9f6529b3d3a1ec681a84735d57a9f2d8656809af.tar.xz |
GUI version n-1
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1694 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui/timer.c')
-rw-r--r-- | Gui/timer.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Gui/timer.c b/Gui/timer.c new file mode 100644 index 0000000000..1cdf9453d3 --- /dev/null +++ b/Gui/timer.c @@ -0,0 +1,37 @@ + +#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 ); +} + |