1 #pragma ident "%Z%%M% %I% %E% SMI"
2 /* from UCB 5.1 85/06/05 */
5 * Copyright (c) 1985 Regents of the University of California.
6 * All rights reserved. The Berkeley software License Agreement
7 * specifies the terms and conditions for redistribution.
12 #define USPS 1000000 /* # of microseconds in a second */
15 * Generate a SIGALRM signal in ``usecs'' microseconds.
16 * If ``reload'' is non-zero, keep generating SIGALRM
17 * every ``reload'' microseconds after the first signal.
21 register unsigned usecs
;
22 register unsigned reload
;
24 struct itimerval
new, old
;
26 new.it_interval
.tv_usec
= reload
% USPS
;
27 new.it_interval
.tv_sec
= reload
/ USPS
;
29 new.it_value
.tv_usec
= usecs
% USPS
;
30 new.it_value
.tv_sec
= usecs
/ USPS
;
32 if (setitimer(ITIMER_REAL
, &new, &old
) == 0)
33 return (old
.it_value
.tv_sec
* USPS
+ old
.it_value
.tv_usec
);