1
Index: xscreensaver-5.04/utils/fade.c
2
===================================================================
3
--- xscreensaver-5.04.orig/utils/fade.c 2008-01-29 20:38:20.000000000 +0100
4
+++ xscreensaver-5.04/utils/fade.c 2008-01-29 20:39:23.000000000 +0100
10
+sleep_from (struct timeval *now, struct timeval *then, long usecs_per_step)
12
+ /* If several seconds have passed, the machine must have been asleep
13
+ or thrashing or something. Don't sleep in that case, to avoid
14
+ overflowing and sleeping for an unconscionably long time. This
15
+ function should only be sleeping for very short periods.
17
+ if (now->tv_sec - then->tv_sec < 5)
19
+ long diff = (((now->tv_sec - then->tv_sec) * 1000000) +
20
+ now->tv_usec - then->tv_usec);
21
+ if (usecs_per_step > diff)
22
+ usleep (usecs_per_step - diff);
25
+ then->tv_sec = now->tv_sec;
26
+ then->tv_usec = now->tv_usec;
31
/* The business with `cmaps_per_screen' is to fake out the SGI 8-bit video
32
hardware, which is capable of installing multiple (4) colormaps
33
simultaneously. We have to install multiple copies of the same set of
36
/* If we haven't already used up our alotted time, sleep to avoid
37
changing the colormap too fast. */
39
- long diff = (((now.tv_sec - then.tv_sec) * 1000000) +
40
- now.tv_usec - then.tv_usec);
41
- then.tv_sec = now.tv_sec;
42
- then.tv_usec = now.tv_usec;
43
- if (usecs_per_step > diff)
44
- usleep (usecs_per_step - diff);
46
+ sleep_from (&now, &then, usecs_per_step);
52
/* If we haven't already used up our alotted time, sleep to avoid
53
changing the colormap too fast. */
55
- long diff = (((now.tv_sec - then.tv_sec) * 1000000) +
56
- now.tv_usec - then.tv_usec);
57
- then.tv_sec = now.tv_sec;
58
- then.tv_usec = now.tv_usec;
59
- if (usecs_per_step > diff)
60
- usleep (usecs_per_step - diff);
62
+ sleep_from (&now, &then, usecs_per_step);
68
/* If we haven't already used up our alotted time, sleep to avoid
69
changing the colormap too fast. */
71
- long diff = (((now.tv_sec - then.tv_sec) * 1000000) +
72
- now.tv_usec - then.tv_usec);
73
- then.tv_sec = now.tv_sec;
74
- then.tv_usec = now.tv_usec;
75
- if (usecs_per_step > diff)
76
- usleep (usecs_per_step - diff);
78
+ sleep_from (&now, &then, usecs_per_step);