[phobos] Proposal of StopWatch module

SHOO zan77137 at nifty.com
Tue Aug 17 06:22:54 PDT 2010


(2010/08/17 21:05), Steve Schveighoffer wrote:
> in anticipation of what might happen...
>
> Tango does have a StopWatch object, it looks like this (API only):
>
> void start()
> Start the timer
> double stop()
> Stop the timer and return elapsed duration since start()
> ulong microsec()
> Return elapsed time since the last start() as microseconds
> static this()
> Setup timing information for later use
> ulong timer() [private, static]
> Return the current time as an IntervalI hate to do this, but I don't want to
> incur any more issues from the Tango team.  Have you looked at this tango module
> before writing your StopWatch object (note the StopWatch module is separate from
> the other tango modules)?

No, I haven't.

This module originates codes that I made when I used C++ (more than 5 
years ago).
I know that Tango is having similar class. But I have never, not once, 
used Tango's StopWatch.
It of Tango loses accuracy clearly as far as I look API. It of Tango 
seems to lose accuracy as far as I look APIs.


FYI, I named this class Timer at first.
But "timer" is strong in an impression called a tool generating a 
specific event after a certain period of time for me. It resembles the 
function that an alarm clock sounds alarm.
Additionally, my StopWatch imitates real stopwatch.
e.g.)
Constructor/reset() = Push initialize button
start() = Push start button
stop() = Push pause button(toggle)
peek() = Watch the display and read numbers
start() = Push pause button(toggle)
peek() = Peek the display in real time


More information about the phobos mailing list