www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Get millisecond difference between 2 times

reply "MrOverkill" <stingerbarb gmail.com> writes:
Dear sirs and madams and... Other things on internet forums,

I am attempting to write a program, and I was wondering how to 
get the time difference between point a and point b.  For example


long a, b;
int thingy;
this()
{
   a = 0; // Or whatever function should be used to set an initial 
value
   b = 0; // Same as a
   thingy = 0;
}
void run()
{
   // Do intensive calculations...
   b = System.currentTimeMillis(); // Only ever done this in Java 
:P
   thingy++;
   if((b-a) >= 500)
   {
     b = a;
     // Do something with thingy...
   }
}

Any idea how this might work with actual code instead of fake 
code?
Apr 05 2014
parent reply "safety0ff" <safety0ff.dev gmail.com> writes:
On Sunday, 6 April 2014 at 02:12:41 UTC, MrOverkill wrote:
 Dear sirs and madams and... Other things on internet forums,

 I am attempting to write a program, and I was wondering how to 
 get the time difference between point a and point b.
You should look into: and I'd likely use a StopWatch. Also, you should use D.learn for questions like this.
Apr 05 2014
parent "MrOverkill" <stingerbarb gmail.com> writes:
On Sunday, 6 April 2014 at 02:31:29 UTC, safety0ff wrote:
 On Sunday, 6 April 2014 at 02:12:41 UTC, MrOverkill wrote:
 Dear sirs and madams and... Other things on internet forums,

 I am attempting to write a program, and I was wondering how to 
 get the time difference between point a and point b.
You should look into: and I'd likely use a StopWatch. Also, you should use D.learn for questions like this.
Thank you very much, good (sir/madam/other)
Apr 05 2014