1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifndef lint
8: static char sccsid[] = "@(#)hertz.c 5.1 (Berkeley) 6/4/85";
9: #endif not lint
10:
11: #include <sys/time.h>
12:
13: /*
14: * discover the tick frequency of the machine
15: * if something goes wrong, we return 0, an impossible hertz.
16: */
17: #define HZ_WRONG 0
18:
19: hertz()
20: {
21: struct itimerval tim;
22:
23: tim.it_interval.tv_sec = 0;
24: tim.it_interval.tv_usec = 1;
25: tim.it_value.tv_sec = 0;
26: tim.it_value.tv_usec = 0;
27: setitimer(ITIMER_REAL, &tim, 0);
28: setitimer(ITIMER_REAL, 0, &tim);
29: if (tim.it_interval.tv_usec < 2)
30: return(HZ_WRONG);
31: return (1000000 / tim.it_interval.tv_usec);
32: }
Defined functions
hertz
defined in line
19; used 1 times
Defined variables
sccsid
defined in line
8;
never used
Defined macros