aboutsummaryrefslogtreecommitdiffstats
path: root/alarm.c
blob: a0bfa356edbdb4ad0da7822ec88ba3c1082ced0a (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
#include <signal.h>
#include <stdio.h>
#include <sys/select.h>
#include <unistd.h>
#include <time.h>

volatile unsigned int variable = 0;
volatile unsigned int print_variable = 0;

void alarm_handler(int signum)
{
    alarm(60);
}

int main()
{        
    signal(SIGALRM, alarm_handler);
    alarm(1);

    for (;;)
    {
        select(0, NULL, NULL, NULL, NULL);
 time_t t = time(NULL);
 struct tm tm = *localtime(&t);
 printf("%d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);

    }
}
39356945b3a9f2081f035c32c1&follow=1'>[lcd4linux @ 2001-03-12 13:44:58 by reinelt]reinelt8-58/+232 2001-03-12[lcd4linux @ 2001-03-12 12:49:24 by reinelt]reinelt2-63/+71 2001-03-12[lcd4linux @ 2001-03-12 12:39:36 by reinelt]reinelt14-448/+830 2001-03-09[lcd4linux @ 2001-03-09 16:24:30 by ltoetsch]ltoetsch2-155/+345 2001-03-09[lcd4linux @ 2001-03-09 15:04:53 by reinelt]reinelt3-103/+109 2001-03-09[lcd4linux @ 2001-03-09 14:30:01 by reinelt]reinelt1-0/+7 2001-03-09[lcd4linux @ 2001-03-09 14:24:49 by ltoetsch]ltoetsch3-7/+18 2001-03-09[lcd4linux @ 2001-03-09 13:08:11 by ltoetsch]ltoetsch12-86/+384 2001-03-09[lcd4linux @ 2001-03-09 12:14:24 by reinelt]reinelt4-21/+34 2001-03-08[lcd4linux @ 2001-03-08 15:25:38 by ltoetsch]ltoetsch9-93/+214 2001-03-08[lcd4linux @ 2001-03-08 09:02:04 by reinelt]reinelt4-133/+21 2001-03-08[lcd4linux @ 2001-03-08 08:39:54 by reinelt]reinelt2-4/+12 2001-03-07[lcd4linux @ 2001-03-07 18:10:21 by ltoetsch]ltoetsch10-110/+319 2001-03-05[lcd4linux @ 2001-03-05 18:20:21 by reinelt]reinelt2-13/+25 2001-03-04[lcd4linux @ 2001-03-04 15:01:12 by ltoetsch]ltoetsch1-3/+3 2001-03-02[lcd4linux @ 2001-03-02 20:18:12 by reinelt]reinelt3-36/+89