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);

    }
}
d20fde406&follow=1'>Refactor codeJonathan McCrohan2-6/+4 2012-03-05Add syslog loggingJonathan McCrohan1-24/+57 2012-03-04Remove unused #define statementsJonathan McCrohan1-3/+0 2012-02-20Prune archive after 3 monthsJonathan McCrohan3-0/+7 2012-02-20Update documentationJonathan McCrohan1-3/+5 2012-02-20Add PHP to make installJonathan McCrohan1-0/+3 2012-02-20Update MakefileJonathan McCrohan1-0/+17 2012-02-20Move interval.txt to src/Jonathan McCrohan2-1/+1 2012-02-19Remove debug/testing files.Jonathan McCrohan50-4742/+0 2012-02-15Archive files after upload.Jonathan McCrohan1-0/+2 2012-02-12Fix typo in README.Jonathan McCrohan1-1/+1 2012-02-12Add ftp upload function + add documentation.Jonathan McCrohan5-3/+151 2012-01-10Handle 32bit signed overflow.Jonathan McCrohan1-1/+6 2012-01-10Update README.Jonathan McCrohan1-1/+3