#include "givalarm.C"

class Alarmed : public GivAlarm {
public:
    Alarmed(long sec, long usec = 0) : GivAlarm(sec, usec), x(0) {}
    
    Alarmed(double time) : GivAlarm(time), x(0) {}

    void operator() ( ) {
            // Là doit se trouver l'algo.
        while(1) {
            ++x;
        }
    }

    friend ostream& operator<< (ostream& o, const Alarmed& a) {
        return o << a.x;
    }

private:
    int x;
};


#include "givtimer.C"

int main(int argc, char * argv[])  {

    
    double time_interval = 1.0;
    if (argc > 1)
        time_interval = atof(argv[1]);

    int x = 0;
    Alarmed dring( time_interval );

    Timer tim; tim.start();
    dring.run();
    tim.stop();
    
    
    cout << dring << " --> " << tim << endl;
    
}

