How does one represent Duration in only Micro-seconds, or milliseconds. Trying to measure the execution time of an algorithm and I get "4 ms, 619 μs, and 8 hnsecs" , I want to sum all these and get total hnsecs or μs .

I would also appreciate advise on whether this is the best way to measure the execution time of an algorithm.



import std.datetime;
import std.stdio;

void algorithm( ){
        writeln("Hello!");
}
void main(){

        auto stattime = Clock.currTime();
        algorithm( );
        endttime = Clock.currTime();

        auto duration = endttime - stattime;

        writeln("Hello Duration ==> ", duration);

}

Reply via email to