00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "defs.h"
00022
00023
00024 static void slp_handler(int signum)
00025 {
00026 }
00027
00028 unsigned aup_sleep(unsigned secs)
00029 {
00030 struct sigaction act;
00031 unsigned unslept;
00032
00033 memset(&act, 0, sizeof(act));
00034 act.sa_handler = slp_handler;
00035 ec_neg1( sigaction(SIGALRM, &act, NULL) )
00036 alarm(secs);
00037 pause();
00038 unslept = alarm(0);
00039 return unslept;
00040
00041 EC_CLEANUP_BGN
00042 EC_FLUSH("aup_sleep")
00043 return 0;
00044 EC_CLEANUP_END
00045 }
00046
00047 int main(void)
00048 {
00049 time_t tm;
00050
00051 time(&tm);
00052 printf("Test 1 -- time %ld\n", (long)tm);
00053 aup_sleep(6);
00054 time(&tm);
00055 printf("Exiting -- time %ld\n", (long)tm);
00056 exit(EXIT_SUCCESS);
00057 }