#ifndef TIMER_H
#define TIMER_H

#include <unistd.h> // gettimeofday

class Timer
{
private:
    const static int fDays[12];
    double fMs;
    double fDiv;
    int fSec;
    int fSecs;
    int fMin;
    int fHor;
    int fDay;
    int fMon;
    int fYea;

    char fDateStr[27];

public:
    Timer() : fMs(0), fSec(0), fSecs(0), fMin(0), fHor(0), fDay(0), fMon(0), fYea(0) {}
    Timer(double t);
    Timer(struct timeval *tv);
    Timer(Timer &t);

    void SetTimer(int tv_sec, double tv_usec);
    void SetTimer(const struct timeval *tv);


    int GetSecs() { return fSecs; }
    double Now(); //[s]
    double CalcMjd();

    int H() const { return fHor; }
    int M() const { return fMin; }
    int S() const { return fSec; }

    const char *GetTimeStr();

    void Print();

    operator double(); //[s]
};

#endif
