Thread overview | |||||
---|---|---|---|---|---|
|
April 06, 2014 Get millisecond difference between 2 times | ||||
---|---|---|---|---|
| ||||
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? |
April 06, 2014 Re: Get millisecond difference between 2 times | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrOverkill | 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: http://dlang.org/phobos/std_datetime.html#.Clock and http://dlang.org/phobos/std_datetime.html#.StopWatch I'd likely use a StopWatch. Also, you should use D.learn for questions like this. |
April 06, 2014 Re: Get millisecond difference between 2 times | ||||
---|---|---|---|---|
| ||||
Posted in reply to safety0ff | 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:
> http://dlang.org/phobos/std_datetime.html#.Clock
> and
> http://dlang.org/phobos/std_datetime.html#.StopWatch
> I'd likely use a StopWatch.
>
> Also, you should use D.learn for questions like this.
Thank you very much, good (sir/madam/other)
|
Copyright © 1999-2021 by the D Language Foundation