24.11 TIMER

It is a utility class it has been coded as BPtimer1 and BPtimer2.

class BPtimer1

    { private :      static long t0;      static long t1;      static long t2;    public :      static void start()         { time(&t0);         }      static void stop()         { t2 = time(&t1) - t0 ;          //cout << “time measured = ” << t2          //     << “ milliSeconds” << endl ;         }    static int show()        { return t2 ;        }    } ;

class BPtimer2

    { private :      long t0;      long t1;      long t2;    public :      void start()        { time(&t0);        }      void stop()        { t2 = time(&t1) - t0 ;         //cout << “time measured = “       << t2         //     << “ milliSeconds” <<endl ;        }      int show()

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.