sleep() problem when Time Hits Midnight
Code:
Hi all,
I want to make my application to sleep for a second so i have implemented it with
static void
sleep(int iSecs)
{
int iCount=0;
unsigned long int t=clock()+(1000L*iSecs);
while(clock()<t)
;
}
which is working fine. The problem comes when the Time hits to 11:59:58 PM
the clock() reduces to 0 n mean while t has reached maximum value as a result this while loop is going too long n making my program halt for more than 30 min.
How do i come out from this problem? Is ther any subsitute solution for sleep() which supports with 16 bit compiler
sleep() Problem when time Hits midnight
Code:
i have tried with it but the compiler is not Supporting that...
it has undefined i have used dos.h header also.....
then i tried breaking the loop for so much of count
while(clock()<t)
{
iCount++;
if(iCount>15000)
break;
}
Its working fine now. But can i consider this solution as a standard programming solution?