I'm trying to write a time delay loop in Borland C 3.1 (for legacy
code) which has an accuracy of about 0.1ms. This change is due to a
hardware change and the software is now running too fast to take
proper readings. I have been using delay(1) in the past but it does
not have the accuracy that I need for this situation. Does anyone
know of a useful C function which can be used to create the time
delay? If anyone could help that would be greatly appreciated.
Cheers and good luck :-). 8 4235
In article <20************ *************** *******@m1g2000 pre.googlegroup s.com>,
Craig Williamson <cr************ @gmail.comwrote :
>I'm trying to write a time delay loop in Borland C 3.1 (for legacy code) which has an accuracy of about 0.1ms. This change is due to a hardware change and the software is now running too fast to take proper readings. I have been using delay(1) in the past but it does not have the accuracy that I need for this situation. Does anyone know of a useful C function which can be used to create the time delay? If anyone could help that would be greatly appreciated.
Sorry, no portable way. See http://c-faq.com/osdep/subsecond.html
--
"The human mind is so strangely capricious, that, when freed from
the pressure of real misery, it becomes open and sensitive to the
ideal apprehension of ideal calamities." -- Sir Walter Scott
Craig Williamson wrote:
I'm trying to write a time delay loop in Borland C 3.1 (for legacy
code) which has an accuracy of about 0.1ms. This change is due to a
hardware change and the software is now running too fast to take
proper readings. I have been using delay(1) in the past but it does
not have the accuracy that I need for this situation. Does anyone
know of a useful C function which can be used to create the time
delay? If anyone could help that would be greatly appreciated.
Cheers and good luck :-).
Use some of the timing functions in windows. I do not remember if
GetTickCount() was already there in 16 bits windows but you could
try that one.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
"jacob navia" <ja***@nospam.c omwrote in message
news:fu******** **@aioe.org...
Craig Williamson wrote:
>I'm trying to write a time delay loop in Borland C 3.1 (for legacy code) which has an accuracy of about 0.1ms. This change is due to a hardware change and the software is now running too fast to take proper readings. I have been using delay(1) in the past but it does not have the accuracy that I need for this situation. Does anyone know of a useful C function which can be used to create the time delay? If anyone could help that would be greatly appreciated. Cheers and good luck :-).
Use some of the timing functions in windows. I do not remember if
GetTickCount() was already there in 16 bits windows but you could
try that one.
Gettickcount returns milliseconds, and may have an accuracy coarser than
that.
But if the OP is trying to slow down software, there are plenty of ways!
Although getting a delay consistent across machines, and with different
machine loading, is not so easy.
--
Bart
Bartc wrote:
"jacob navia" <ja***@nospam.c omwrote in message
news:fu******** **@aioe.org...
>Craig Williamson wrote:
>>I'm trying to write a time delay loop in Borland C 3.1 (for legacy code) which has an accuracy of about 0.1ms. This change is due to a hardware change and the software is now running too fast to take proper readings. I have been using delay(1) in the past but it does not have the accuracy that I need for this situation. Does anyone know of a useful C function which can be used to create the time delay? If anyone could help that would be greatly appreciated. Cheers and good luck :-).
Use some of the timing functions in windows. I do not remember if GetTickCount () was already there in 16 bits windows but you could try that one.
Gettickcount returns milliseconds, and may have an accuracy coarser than
that.
But if the OP is trying to slow down software, there are plenty of ways!
Although getting a delay consistent across machines, and with different
machine loading, is not so easy.
There is Sleep(int miliseconds) too.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
jacob navia wrote:
Bartc wrote:
.... snip ...
>
>But if the OP is trying to slow down software, there are plenty of ways! Although getting a delay consistent across machines, and with different machine loading, is not so easy.
There is Sleep(int miliseconds) too.
Where? I don't find it in the C standard. Could you be making a
mistake and recommending functions that are not available, and thus
off-topic here? Give us the appropriate section and I will
apologize.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
** Posted from http://www.teranews.com **
CBFalconer <cb********@yah oo.comwrites:
jacob navia wrote:
>Bartc wrote:
... snip ...
>>
>>But if the OP is trying to slow down software, there are plenty of ways! Although getting a delay consistent across machines, and with different machine loading, is not so easy.
There is Sleep(int miliseconds) too.
Where? I don't find it in the C standard. Could you be making a
mistake and recommending functions that are not available, and thus
off-topic here? Give us the appropriate section and I will
apologize.
You could save yourself some typing, and the rest of us some boredom,
by just mentioning that Sleep is non-standard. The shtick about
challenging people to find things in the standard that obviously
aren't there is getting old, don't you think?
--
Keith Thompson (The_Other_Keit h) <ks***@mib.or g>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Keith Thompson wrote:
CBFalconer <cb********@yah oo.comwrites:
>jacob navia wrote:
>>Bartc wrote:
... snip ...
>>> But if the OP is trying to slow down software, there are plenty of ways! Although getting a delay consistent across machines, and with different machine loading, is not so easy.
There is Sleep(int miliseconds) too.
Where? I don't find it in the C standard. Could you be making a mistake and recommending functions that are not available, and thus off-topic here? Give us the appropriate section and I will apologize.
You could save yourself some typing, and the rest of us some boredom,
by just mentioning that Sleep is non-standard. The shtick about
challenging people to find things in the standard that obviously
aren't there is getting old, don't you think?
The aim of that post (but probably hopeless) is to get Jacob to
realize what is and is not on-topic here.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
** Posted from http://www.teranews.com **
CBFalconer <cb********@yah oo.comwrites:
Keith Thompson wrote:
>CBFalconer <cb********@yah oo.comwrites:
>>jacob navia wrote: Bartc wrote:
... snip ...
But if the OP is trying to slow down software, there are plenty of ways! Although getting a delay consistent across machines, and with different machine loading, is not so easy.
There is Sleep(int miliseconds) too.
Where? I don't find it in the C standard. Could you be making a mistake and recommending functions that are not available, and thus off-topic here? Give us the appropriate section and I will apologize.
You could save yourself some typing, and the rest of us some boredom, by just mentioning that Sleep is non-standard. The shtick about challenging people to find things in the standard that obviously aren't there is getting old, don't you think?
The aim of that post (but probably hopeless) is to get Jacob to
realize what is and is not on-topic here.
Understood. My statement above stands.
--
Keith Thompson (The_Other_Keit h) <ks***@mib.or g>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Conrad |
last post by:
Greetings,
Q: Is there some way to gracefully suspend a python app for a second or
so then resume? I could write the classic basic dumb
loop-tenzillion-times delay, but that seems inelegant, and well, just
wrong. By the way, I'm also using wxPython, if that helps any.
I need to delay a python program for about a second. Googling around, it
looks like most of the timer stuff has to do with thread handling, but my
application is not...
|
by: Maheshkumar.R |
last post by:
Hi groups,
How i can introduce some milliseconds delay in application. How i can do
achieve this...
let me clearly say...
(1) I'm displaying slices of medical images.
For framerate - for this i'm loading 2+ slices, 4+ slices in loop
to have cine impact..-> Ok working
(2) But if i want to reduce the speed...how i can introduce delay inbetween
|
by: barry |
last post by:
I'm having a problem creating a delay before each list item gets moved
( http://www.polisource.com/PublicMisc/list-splitter-timeout-bug.html
). Choose any number of columns, vertical layout, and view as a web
page. They'll be a small delay before the entire bunch of list items
converts from left-to-right to top-to-bottom order. I expected a delay
before each item is moved. It looks like I have to flush the buffer to
get setTimeout to work,...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I make a 10 second delay?
-----------------------------------------------------------------------
There is no built-in way to pause execution in javascript such
as a sleep function, but hosts usually provide a method of some
form. Web browsers are designed for event driven programming and
only provide the « setTimeout » and « setInterval »...
|
by: Spitfire |
last post by:
I've a requirement to find the elapsed time between two function
calls. I need to find the time elapsed accurate to 1 millisecond.
The problem I'm facing right now is that, I'm using the 'time()'
function call for the purpose and regardless of how many time I invoke
the function within my program, I get the same output!!!
For better clarity consider the code snippet below.
...
start_time = time(NULL);
| |
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |