diff --git a/include/timer.h b/include/timer.h new file mode 100644 index 0000000..1ac7d5c --- /dev/null +++ b/include/timer.h @@ -0,0 +1,6 @@ +#ifndef TIMER_H +#define TIMER_H + +void start_timer(void); + +#endif \ No newline at end of file diff --git a/src/timer.c b/src/timer.c new file mode 100644 index 0000000..8125b2c --- /dev/null +++ b/src/timer.c @@ -0,0 +1,24 @@ +#include +#include +#include +#define delta 1000000L + +void start_timer(void) { + unsigned long int start = Microsecondes(); + unsigned int minute = 0; + unsigned int a = 0; + + char buf[100]; + while(1){ + unsigned long int seconde = ((Microsecondes() - start) / 1000000)-a; + + if (seconde>=60) { + minute +=1; + a += 60; + } + + snprintf(buf, 100, "temps : %02d:%02d", minute, seconde); + + EcrireTexte(20,20, buf, 1); + } +} \ No newline at end of file