summaryrefslogtreecommitdiff
path: root/timetest.c
diff options
context:
space:
mode:
Diffstat (limited to 'timetest.c')
-rw-r--r--timetest.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/timetest.c b/timetest.c
new file mode 100644
index 0000000..a00c5ca
--- /dev/null
+++ b/timetest.c
@@ -0,0 +1,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);
+ }
+ }
+}
+