www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D timer

reply "SaltySugar" <Butkustomas777 gmail.com> writes:
Can i do my own timer in D console application?
like in C# timer_Tick event.
Feb 10 2013
next sibling parent "rumbu" <rumbu rumbu.ro> writes:
On Sunday, 10 February 2013 at 14:49:15 UTC, SaltySugar wrote:
 Can i do my own timer in D console application?
 like in C# timer_Tick event.
There is no Timer in D as you know it from C# and also there are no events. You must rely on SetTimer WinAPI and write your own TimerProc.
Feb 10 2013
prev sibling next sibling parent reply David <d dav1d.de> writes:
Am 10.02.2013 15:49, schrieb SaltySugar:
 Can i do my own timer in D console application?
 like in C# timer_Tick event.
Not sure what you mean, but I have a pretty solid Timer implementation (Threaded) https://github.com/Dav1dde/BraLa/blob/master/brala/utils/thread.d The file has no dependencies, so copy it over and have fun. License of the whole application is GPLv3, but if you need it relicensed drop me an e-mail or notify me somehow
Feb 10 2013
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
David:

 Not sure what you mean, but I have a pretty solid Timer 
 implementation
 (Threaded)

 https://github.com/Dav1dde/BraLa/blob/master/brala/utils/thread.d

 The file has no dependencies, so copy it over and have fun. 
 License of
 the whole application is GPLv3, but if you need it relicensed 
 drop me an
 e-mail or notify me somehow
It's a common need. So maybe it's a good idea to put a version of that code in Phobos. Bye, bearophile
Feb 26 2013
parent David <d dav1d.de> writes:
Am 26.02.2013 14:19, schrieb bearophile:
 David:
 
 Not sure what you mean, but I have a pretty solid Timer implementation
 (Threaded)

 https://github.com/Dav1dde/BraLa/blob/master/brala/utils/thread.d

 The file has no dependencies, so copy it over and have fun. License of
 the whole application is GPLv3, but if you need it relicensed drop me an
 e-mail or notify me somehow
It's a common need. So maybe it's a good idea to put a version of that code in Phobos. Bye, bearophile
I asked a while ago on the main NG if I should make it phobos compatible, answer was no.
Feb 27 2013
prev sibling parent "heromyth" <bitworld qq.com> writes:
On Sunday, 10 February 2013 at 14:49:15 UTC, SaltySugar wrote:
 Can i do my own timer in D console application?
 like in C# timer_Tick event.
I have also created one. Please, see here: https://bitbucket.org/heromyth/dtoolkit/src/a8b5f8874e3d82373b71a2ca5c9f02a73362b56a/toolkit/System/Timer.d?at=default It ported from http://www.codeproject.com/Articles/98346/Microsecond-and-Millisecond-NET-Timer
Feb 26 2013