From a27bd419b44f5f258f99cbead1fefec8dd6655ab Mon Sep 17 00:00:00 2001 From: orfao Date: Sun, 3 Dec 2023 12:24:53 +0100 Subject: [PATCH] =?UTF-8?q?probl=C3=A8me=20du=20timer=20partiellement=20r?= =?UTF-8?q?=C3=A9gl=C3=A9=20:=20segmentation=20fault=20en=20fin=20de=20pro?= =?UTF-8?q?gamme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/timer.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/timer.c b/src/timer.c index 691e9e3..9946896 100644 --- a/src/timer.c +++ b/src/timer.c @@ -4,16 +4,14 @@ void creer_timer(void){ int sec = 0,mil_sec=0,min=0; - unsigned long temps = 0; - printf("temps : %lu\n",temps); - while(min<=2){ - printf("[%d:%d,%d]\n",min,sec,mil_sec); - temps=Microsecondes(); - printf("temps : %lu\n",temps); - sec=(temps/1000000)%60; - mil_sec=(temps/1000)%101; + unsigned long temps = 0,t1=0; + t1=Microsecondes(); + while(sec<=12){ + printf("[%0.2d:%0.2d]\n",min,sec); + temps=Microsecondes()-t1; min=(temps/60000000)%60; - printf("[%d:%d,%d]\n",min,sec,mil_sec); + temps=temps%60000000; + sec=(temps/1000000)%60; } }