diff options
author | Josh <eeei3.joshua0307lol@gmail.com> | 2025-01-18 17:23:13 -0500 |
---|---|---|
committer | Josh <eeei3.joshua0307lol@gmail.com> | 2025-01-18 17:23:13 -0500 |
commit | 40ba4fb38336b7ebc26729f69c550cc50b404e7d (patch) | |
tree | 7dfbc4729909318e718749cbdc96c2546b73715d | |
parent | e448957c4cc518234d8f6a92219fe649568131d6 (diff) |
feat: created timetest.c to test some timing stuff
-rw-r--r-- | timetest.c | 24 |
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); + } + } +} + |