>>>>>>
The timer-tick interrupt 1Ch is not a DOS service but is in fact set up by the system BIOS.
<<<<<<
Sorry I didn''t mean suggest that it was, I just meant if you are programming a DOS program(Real Mode) then you can get to that address. Protected Mode compilers won''t let you =)
Timeing in C
October 18, 2002 10:36 PM
This is what i''ve come up with, comments welcome.(My home comp is down so it''s untested). The work is done in the sub-function. a user sets the length at the command prompt and the programe cycles till the number of seconds have pasted.
dos.h
stuct dostime_t dtime;
stuct dostime_t etime;
void sleeper(int);
void main(){
int wsec;
_dos_gettime(&dtime);
printf("\nThe time is: %02u.%02u.%02u\n",dtime.min,dtime.sec,dtime.hsec);
printf("Set Sleep Timer(sec):";
scanf("%d",wsec);
sleeper(wsec);
_dos_gettime(&dtime);
printf("\nThe time is: %02u.%02u.%02u\n",dtime.min,dtime.sec,dtime.hsec);
}
{
void sleeper(wsec)
{
int count=0;
do{
_dos_gettime(&dtime);
do{
_dos_gettime(&etime);
while(dtime.sec==etime.sec);
count++;
while(count!=wsec);
}
Memoo
dos.h
stuct dostime_t dtime;
stuct dostime_t etime;
void sleeper(int);
void main(){
int wsec;
_dos_gettime(&dtime);
printf("\nThe time is: %02u.%02u.%02u\n",dtime.min,dtime.sec,dtime.hsec);
printf("Set Sleep Timer(sec):";
scanf("%d",wsec);
sleeper(wsec);
_dos_gettime(&dtime);
printf("\nThe time is: %02u.%02u.%02u\n",dtime.min,dtime.sec,dtime.hsec);
}
{
void sleeper(wsec)
{
int count=0;
do{
_dos_gettime(&dtime);
do{
_dos_gettime(&etime);
while(dtime.sec==etime.sec);
count++;
while(count!=wsec);
}
Memoo
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement