summaryrefslogtreecommitdiff
path: root/app/xlockmore/xlock/erase.h
blob: b4abaa6816f14bc5d929762aa5c587673ad52c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#if !defined( lint ) && !defined( SABER )
/* #ident	"@(#)erase.h	4.14 99/06/17 xlockmore" */

#endif

/*-
 * Erase stuff
 *
 * See xlock.c for copying information.
 *
 * Revision History:
 * 17-06-99: Started log. :)
 */

#if HAVE_GETTIMEOFDAY
		GETTIMEOFDAY(&tp);
		if (tp.tv_sec - t0 >= erasetime ) {
			break;
		}
#endif
		if (actual_delay > 0 && ((LOOPVAR % granularity) == 0))
#if HAVE_GETTIMEOFDAY
		{
			interval = (int) (tp.tv_usec - t_prev +
				1000000 * ( tp.tv_sec - t1_prev ));
			interval = actual_delay * granularity - interval;
			if (interval > 0)
				(void) usleep(interval);
			GETTIMEOFDAY(&tp);
			t_prev = (int) (tp.tv_usec);
			t1_prev = (int) (tp.tv_sec);
		}
#else
			(void) usleep( actual_delay * granularity );
#endif