digitalmars.D.learn - StopWatch
- Shriramana Sharma (11/11) Oct 20 2015 http://dlang.org/phobos/std_datetime.html#StopWatch shows the use of
- Jonathan M Davis via Digitalmars-d-learn (17/26) Oct 20 2015 There's currently a PR open to replace StopWatch with another one which
- Russel Winder via Digitalmars-d-learn (14/19) Oct 20 2015 What import statement do you use to get MonoTime. =C2=A0I tried the abov...
- Russel Winder via Digitalmars-d-learn (18/21) Oct 20 2015 Hummm=E2=80=A6 I am now not worried about the import, I tried compiling ...
http://dlang.org/phobos/std_datetime.html#StopWatch shows the use of TickDuration to measure the time elapsed, but http://dlang.org/phobos/core_time.html#TickDuration says TickDuration is due to be deprecated and MonoTime should be used. It is possible to measure the duration between two points of one's program using MonoTime.currTime whose unit is Duration. 1) Will then StopWatch be modified to use MonoTime? 2) Is StopWatch still useful? 3) Or should it also be deprecated? --
Oct 20 2015
On Tuesday, October 20, 2015 13:18:12 Shriramana Sharma via Digitalmars-d-learn wrote:http://dlang.org/phobos/std_datetime.html#StopWatch shows the use of TickDuration to measure the time elapsed, but http://dlang.org/phobos/core_time.html#TickDuration says TickDuration is due to be deprecated and MonoTime should be used. It is possible to measure the duration between two points of one's program using MonoTime.currTime whose unit is Duration. 1) Will then StopWatch be modified to use MonoTime? 2) Is StopWatch still useful? 3) Or should it also be deprecated?There's currently a PR open to replace StopWatch with another one which uses Duration and MonoTime instead of TickDuration: https://github.com/D-Programming-Language/phobos/pull/3695 So, std.datetime.StopWatch is going to be deprecated as will every function in druntime or Phobos which uses TickDuration in its public API. They'll be replaced with functions that use MonoTime and Duration. That being said, unless you need to stop measuring the time and start from where you left off, StopWatch isn't necessary. If all you want to do is measure how long something takes, MonoTime is plenty. e.g. auto before = MonoTime.currTime; // do stuff auto diff = MonoTime.currTime - before; The value of StopWatch is entirely in the fact that it can be stopped and started again and measure the total time that it's running rather than just measure the time between two points. - Jonathan M Davis
Oct 20 2015
On Tue, 2015-10-20 at 02:19 -0700, Jonathan M Davis via Digitalmars-d- learn wrote:[=E2=80=A6] =20 auto before =3D MonoTime.currTime; // do stuff auto diff =3D MonoTime.currTime - before;What import statement do you use to get MonoTime. =C2=A0I tried the above and got an error with all the things I tried. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Oct 20 2015
On Tue, 2015-10-20 at 15:16 +0100, Russel Winder wrote:=20[=E2=80=A6]What import statement do you use to get MonoTime. =C2=A0I tried the above and got an error with all the things I tried.Hummm=E2=80=A6 I am now not worried about the import, I tried compiling a different way and it worked. The upshot is that I have had two installations of LDC which are mutually incompatible re core.time and the configuration leads to total wrongness. Forget I ever mumbled on this topic=E2=80=A6 =C2=A0:-) =C2=A0 --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Oct 20 2015