git.samba.org
/
tridge
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Victor86B digital multimeter app
[tridge/junkcode.git]
/
load_math
/
load_math.c
1
#include <signal.h>
2
#include <stdlib.h>
3
#include <stdio.h>
4
#include <unistd.h>
5
#include <string.h>
6
#include <sys/time.h>
7
#include <time.h>
8
#include <math.h>
9
10
double global_v;
11
12
static void alarm_handler(int sig)
13
{
14
struct timeval tv;
15
gettimeofday(&tv,NULL);
16
double v = tan(sin(cos(tv.tv_sec)));
17
v *= 1.3;
18
global_v = v;
19
}
20
21
void _init(void)
22
{
23
struct timeval tv;
24
struct itimerval val;
25
tv.tv_sec = 0;
26
tv.tv_usec = 1;
27
val.it_interval = tv;
28
val.it_value = tv;
29
30
setitimer(ITIMER_REAL, &val, NULL);
31
signal(SIGALRM, alarm_handler);
32
}