3.1 Chronometer

The Chronometer class is used to measure times in various units. It acts as a sports stop watch. It can be very handy to measure program perfomances and help optimization. Allowed time units go from m seconds to plain seconds.


  #include <lyric/Chronometer.hpp>
  class Chronometer
    ~Chronometer ();
    Chronometer (const Unit& unit);
    Chronometer (const Chronometer& chronometer);
    Chronometer& operator = (const Chronometer& chronometer);
    Unit unit () const;
    void start ();
    void stop ();
    double time () const;


See section 3.2 for a full reference of the Chronometer::Unit class.

˜Chronometer ()
Destroys this chronometer. Does pretty nothing.

Chronometer (const Chronometer::Unit& unit)
Constructs this chronometer with a given time unit. There is no default constructor because the time measure unit must always be known. This chronometer is started (time set to zero) in the constructor.

Chronometer (const Chronometer& chronometer)
Clones chronometer into this. The time unit property is copied and this chronometer is started (zeroed).

Chronometer& operator = (const Chonometer& chronometer)
Clones chronometer into this chronometer. The time unit property is copied and this chronometer is started (zeroed).

Chronometer::Unit unit () const
Returns this chronometer’s time measure unit.

void start ()
Starts this chronometer. Sets measured time to zero.

void stop ()
Stops this chronometer. Sets measued time to the difference between now and the start time.

double time () const
Returns the measured time difference between this chronometer’s start and now or the stop time if stop was invoked in some place after a construction, a cloning, or a start.