summaryrefslogtreecommitdiff
path: root/timetest.c
blob: a00c5ca5b25c6201c91078ec7c8f5b7fe6dbe738 (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
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main() {
    unsigned int tdelay = 10;
    unsigned long curtime;
    unsigned long prevtime;
    time_t sec;
    prevtime = time(&sec);
    int swi = 0;
    while (1) {
	if (swi == 0) {
	    printf("we are here\n");
	    swi = 1;
	}
	    curtime = time(&sec);
	    if (curtime - prevtime >= tdelay) {
		printf("Block\n");
		prevtime = time(&sec);
	    }
	}
}