Using the time in Turbo C

Thread Starter

bousyass

Joined Aug 26, 2008
5
Hi every one ,
i want to know how can i use the time in turbo c .
in my program i have to make the user write a word within 10 second .
thanks
 

Mark44

Joined Nov 26, 2007
628
The first place I would start if I were you is in the time.h header, and see what functions were available, such as for getting the system time, or elapsed time. If I recall, you're using a very old version of Turbo C that none of us in this forum have.

Take a look at what is there and report back on what you found.
 

RiJoRI

Joined Aug 15, 2007
536
FWIW, I have a copy of TC 2.0, and (hidden far,far away) the TC 1.5 manuals.

Anyway, the bolded parts may give the OP some idea:
Rich (BB code):
   time(&GUL_StartTime);                       /* Fetch present time */
   GUL_EndTime=GUL_StartTime + PUC_Time;           /* Add search time */

        while(1){
              while(!(GUC_A = lfc_sgetc()))         /* If we haven't received anything, from the SIO port */
              {
               if(lfc_GetOut())                   /* see if the tester has gotten impatient */
                   lf_Terminate(F10_Exit);

            time(&GUL_PresentTime);            /* See if time's up */
                 if(GUL_PresentTime > GUL_EndTime)
               return(TIMEOUT);                /* A-yep! */
            }
GUL_ refers to a Global Unsigned Long

caveat user: I did this such a long time ago that I do not know if I ever used the code, which was part of a serial communications terminal program.

--Rich
 
Last edited:
Top