module timer; import core.stdc.time; class Timer { private: core.stdc.time.clock_t _start_time; public: this() { _start_time=core.stdc.time.clock; } void restart() { _start_time=core.stdc.time.clock; } const double elapsed() { return cast(double)(core.stdc.time.clock-_start_time)/CLOCKS_PER_SEC; } const double elapsed_max() { return cast(double) (core.stdc.time.clock_t.max-_start_time)/cast(double)CLOCKS_PER_SEC; } const double elapsed_min() { return cast(double)(1)/cast(double)CLOCKS_PER_SEC; } }