|
From: Joe B. <jo...@cy...> - 2000-12-04 15:49:33
|
Please don't send any more e-mails @ my address.
----- Original Message ----- Please don't send any more e-mails @ my
address.
From: Chad Simmons <ho...@ho...>
To: <dev...@li...>
Sent: Wednesday, November 29, 2000 11:39 PM
Subject: Re: [Dev-C++] Delay
> >From: "Chris Bunney" <ch...@cb...>
> >Reply-To: dev...@li...
> >To: <dev...@li...>
> >Subject: Re: [Dev-C++] Delay
> >Date: Wed, 29 Nov 2000 18:35:47 -0000
> >
> >Ian,
> >
> >Hi. I dont think dev-c++ has a delay command so I wrote my own, here is
the
> >code:
> >
> >#include <ctime>
> >
> >void delay(int seconds)
> >{
> > clock_t current, end;
> >
> > current = clock();
> > end = current + CLOCKS_PER_SEC * seconds;
> >
> > while(current < end)
> > current = clock(); // loop while current not equal end
> >}
>
>
> Eww.. Waste of CPU time. I suggest using the Win32 API Sleep or _sleep
> functions instead. The reason is that your above delay function is
> constantly working the CPU as it goes through the loop. The Sleep or_sleep
> functions on the otherhand will actually halt the program until the set
> amount of time has passed.
>
> Chad Simmons
>
____________________________________________________________________________
_________
> Get more from the Web. FREE MSN Explorer download :
http://explorer.msn.com
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users
>
|