Path: utzoo!attcan!uunet!mcsun!inria!loria!anigbogu From: anigbogu@loria.crin.fr (Julian ANIGBOGU) Newsgroups: comp.lang.c Subject: Re: MSC delay() routine? Message-ID: <1829@loria.crin.fr> Date: 14 Mar 90 11:45:51 GMT References: <1280001@hpcc01.HP.COM> <1990Mar13.041457.17217@cubmol.bio.columbia.edu> Organization: CRIN & INRIA Lorraine, Nancy, France Lines: 43 In article <1990Mar13.041457.17217@cubmol.bio.columbia.edu> ping@cubmol.bio.columbia.edu (Shiping Zhang) writes: >In article <1280001@hpcc01.HP.COM> azarian@hpcc01.HP.COM (Randy Azarian) writes: >>Does anyone have a delay routine written in C? [deleted] >> struct dostime_t time1, time2; >[...] >> _dos_gettime(&time1); time2=time1; > ^^^^^^^^^^^ >You can't assign a struct like that. You must assign the elements >of a struct individually. > > >-ping You can perfectly and legally assign structs as long as they have the same type as above. time1 and time2 are both of type dostime_t; About the original question, how about defining a macro or a function which takes as input the sleep time required in seconds, calls 'time' the first time to deliver the current time and then looping with calls to 'difftime' and 'time' until the sleep time is passed. Of course, this is approximative but wouldn't matter too much if the sleep time is big. time_t ovalue,nvalue; time(&ovalue); while(difftime((nvalue = time( (time_t *) 0)), ovalue) < sleeptime) continue; I hope that this helps, although I haven't tried it, it looks logical unless ... Note that 'difftime' returns type double, so you have to either pass sleeptime as double or cast it to double in above statement. In any case, I know the dos gurus would have a neat solution to your problem. Julian -- --------------------------------------- e-mail: anigbogu@loria.crin.fr | All opinions expressed here are | | naturally mine. However ... | ----------------------------------------