delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
X-Received: | by 10.236.121.238 with SMTP id r74mr4804726yhh.23.1399504395996; |
Wed, 07 May 2014 16:13:15 -0700 (PDT) | |
X-Received: | by 10.140.20.227 with SMTP id 90mr1536qgj.6.1399504395976; Wed, 07 |
May 2014 16:13:15 -0700 (PDT) | |
Newsgroups: | comp.os.msdos.djgpp |
Date: | Wed, 7 May 2014 16:13:15 -0700 (PDT) |
In-Reply-To: | <alpine.BSF.2.01.1405071031340.80857@freire1.furyyjbeyq.arg> |
Complaints-To: | groups-abuse AT google DOT com |
Injection-Info: | glegroupsg2000goo.googlegroups.com; posting-host=78.102.50.215; |
posting-account=Q0wMHAoAAADjYrghh94FTf6YnbpTqZgp | |
NNTP-Posting-Host: | 78.102.50.215 |
References: | <lkd82j$1g2q$1 AT adenine DOT netfront DOT net> <alpine DOT BSF DOT 2 DOT 01 DOT 1405071031340 DOT 80857 AT freire1 DOT furyyjbeyq DOT arg> |
User-Agent: | G2/1.0 |
MIME-Version: | 1.0 |
Message-ID: | <1011a491-0f56-40d6-aec4-ba518a9c8e6a@googlegroups.com> |
Subject: | Re: djgpp_terminal |
From: | RayeR <glaux AT centrum DOT cz> |
Injection-Date: | Wed, 07 May 2014 23:13:15 +0000 |
X-Received-Bytes: | 2451 |
X-Received-Body-CRC: | 772329237 |
Bytes: | 2793 |
Lines: | 19 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
In DJGPP there is usleep() defined in unistd.h but it's a crap with very coarse granularity, as wtitten in libc.info: This function pauses the program for USEC microseconds. Note that, since `usleep' calls `clock' internally, and the latter has a 55-msec granularity, any argument less than 55msec will result in a pause of random length between 0 and 55 msec. I made my own function udelay() based on uclock() from time.h that is based on sub-microsecond precise timer. //***************** wait for delay us *************************************** void udelay(DWord usec) // based on precise 1us timer uclock(), usable for 10us resolution { // works under DOS/Win9X/NT but not Win3.x volatile uclock_t wait_ticks, t1, t2; if (usec==0) // pokud je prodleva nulova return; // tak hned skonci wait_ticks=((uclock_t)usec*UCLOCKS_PER_SEC)/1000000LL; // pocet cekanych tiku dle usec t1=uclock(); // precti casovac, pocatecni hodnota do { // cekaci smycka t2=uclock(); // precti znova casovac } while ((t2-t1)<wait_ticks); // opakuj dokud je rozdil tiku mensi nez pozadovana hodnota }
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |