Re: Real Time-ing

2015-12-09 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 9 December 2015 at 10:00:46 UTC, Andrea Fontana wrote: On Tuesday, 8 December 2015 at 15:35:18 UTC, Taylor Hillegeist wrote: So, I mostly do programming that is of run to completion verity. But I have a dream of calling functions periodically. So my question is: What is the

Re: Real Time-ing

2015-12-09 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 16:40:04 UTC, Taylor Hillegeist wrote: However i seem to get jitter of around 1 ms. Is there anything else i can do to improve? Do you want to get precision better than period of thread switches?

Re: Real Time-ing

2015-12-09 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 15:35:18 UTC, Taylor Hillegeist wrote: So, I mostly do programming that is of run to completion verity. But I have a dream of calling functions periodically. So my question is: What is the best (most time accurate) way to call a function every n time units?

Re: Real Time-ing

2015-12-08 Thread Kagamin via Digitalmars-d-learn
prev=now; call(); wait(prev+dur-now); call();

Re: Real Time-ing

2015-12-08 Thread Taylor Hillegeist via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 15:50:35 UTC, Kagamin wrote: Oops, no. next+=dur; wait(next-now); call(); what calls does this use from the std library? to get the current time? Wait a amount of time?

Real Time-ing

2015-12-08 Thread Taylor Hillegeist via Digitalmars-d-learn
So, I mostly do programming that is of run to completion verity. But I have a dream of calling functions periodically. So my question is: What is the best (most time accurate) way to call a function every n time units? What is the best way to measure the jitter of these calls? I'm also

Re: Real Time-ing

2015-12-08 Thread Kagamin via Digitalmars-d-learn
Oops, no. next+=dur; wait(next-now); call();

Re: Real Time-ing

2015-12-08 Thread Taylor Hillegeist via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 15:35:18 UTC, Taylor Hillegeist wrote: So, I mostly do programming that is of run to completion I took a stab at the problem: http://dpaste.dzfl.pl/2eef530d00fc 0 nsecs with jitter of :5 nsecs 498937256 nsecs with jitter of :1062744 nsecs 499036173

Re: Real Time-ing

2015-12-08 Thread Chris Wright via Digitalmars-d-learn
On Tue, 08 Dec 2015 15:35:18 +, Taylor Hillegeist wrote: > So, I mostly do programming that is of run to completion verity. > But I have a dream of calling functions periodically. So my question is: > > What is the best (most time accurate) way to call a function every n > time units?

Re: Real Time-ing

2015-12-08 Thread BBaz via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 16:40:04 UTC, Taylor Hillegeist wrote: On Tuesday, 8 December 2015 at 15:35:18 UTC, Taylor Hillegeist wrote: So, I mostly do programming that is of run to completion I took a stab at the problem: http://dpaste.dzfl.pl/2eef530d00fc 0 nsecs with jitter of