Mercurial > emacs
annotate lib-src/=wakeup.c @ 3516:f1ca34ddfd84
(redisplay, echo_area_display): Use redraw_garbaged_frames.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 06 Jun 1993 06:46:06 +0000 |
parents | 274570106c6a |
children | 0810187da5d9 |
rev | line source |
---|---|
77 | 1 /* Program to produce output at regular intervals. */ |
2 | |
3 #include <stdio.h> | |
4 #include <time.h> | |
3437 | 5 #include <sys/time.h> |
77 | 6 |
7 struct tm *localtime (); | |
8 | |
9 main (argc, argv) | |
10 int argc; | |
11 char **argv; | |
12 { | |
13 int period = 60; | |
3336
44df7395bed8
(main): Make when a time_t.
Richard M. Stallman <rms@gnu.org>
parents:
366
diff
changeset
|
14 time_t when; |
77 | 15 struct tm *tp; |
16 | |
17 if (argc > 1) | |
18 period = atoi (argv[1]); | |
19 | |
20 while (1) | |
21 { | |
366 | 22 /* Make sure wakeup stops when Emacs goes away. */ |
23 if (getppid () == 1) | |
24 exit (0); | |
77 | 25 printf ("Wake up!\n"); |
26 fflush (stdout); | |
27 /* If using a period of 60, produce the output when the minute | |
28 changes. */ | |
29 if (period == 60) | |
30 { | |
31 time (&when); | |
32 tp = localtime (&when); | |
33 sleep (60 - tp->tm_sec); | |
34 } | |
35 else | |
36 sleep (period); | |
37 } | |
38 } |