I still don't understand the timer cuestion, qtimer is suposed to call simulator::step() every 1 ms and then a number of calculated steps are "looped" to reach the non-linear rate (1e4) and logic rate (1e6).<br>
<br>But when i drag&drop an ecclock-input to the circuit it should go at 1 Hz, but i goes at 0.25 Hz.. it takes 4S for a complete cicle... in diferent PCs i have diferents timings.. not big diferences.. may be +- 10%.... but 4S for an 1 Hz ecclock-input is a very big error.<br>
<br>I had a look to qtimer at trolltech docs and it doesn't look a very accurate thing:<br>"Note that QTimer's accuracy depends on the underlying operating
system and hardware. Most platforms support an accuracy of 20ms;
some provide more..."<br><br>...An accuracy of 20ms !!!!!!  <br><br><a href="http://doc.trolltech.com/3.3/qtimer.html">http://doc.trolltech.com/3.3/qtimer.html</a><br><br>I think something should be done to improve this.<br>
I have no idea, but looks like C++ doesn't have high-resolution timers... but what about some POSIX functions?, for example gethrtime() looks interesting: it gives the nunber of nanosecods since last boot:<br><br><a href="http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=332">http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=332</a><br>
<br>With a granularity of nanoseconds is possible to do something accurate.<br><br>Is possible there are some posix interfaces in some C or C++ library... i have no idea, but perhaps there are some better solution than using qtimer.<br>
<br>Just a thought...<br>