Line | |
---|
1 | #ifndef TIMER_H
|
---|
2 | #define TIMER_H
|
---|
3 |
|
---|
4 | #include <unistd.h> // gettimeofday
|
---|
5 |
|
---|
6 | class Timer
|
---|
7 | {
|
---|
8 | private:
|
---|
9 | const static int fDays[12];
|
---|
10 | double fMs;
|
---|
11 | double fDiv;
|
---|
12 | int fSec;
|
---|
13 | int fSecs;
|
---|
14 | int fMin;
|
---|
15 | int fHor;
|
---|
16 | int fDay;
|
---|
17 | int fMon;
|
---|
18 | int fYea;
|
---|
19 |
|
---|
20 | char fDateStr[27];
|
---|
21 |
|
---|
22 | public:
|
---|
23 | Timer() : fMs(0), fSec(0), fSecs(0), fMin(0), fHor(0), fDay(0), fMon(0), fYea(0) {}
|
---|
24 | Timer(double t);
|
---|
25 | Timer(struct timeval *tv);
|
---|
26 | Timer(Timer &t);
|
---|
27 |
|
---|
28 | void SetTimer(int tv_sec, double tv_usec);
|
---|
29 | void SetTimer(const struct timeval *tv);
|
---|
30 |
|
---|
31 |
|
---|
32 | int GetSecs() { return fSecs; }
|
---|
33 | double Now(); //[s]
|
---|
34 | double CalcMjd();
|
---|
35 |
|
---|
36 | int H() const { return fHor; }
|
---|
37 | int M() const { return fMin; }
|
---|
38 | int S() const { return fSec; }
|
---|
39 |
|
---|
40 | const char *GetTimeStr();
|
---|
41 |
|
---|
42 | void Print();
|
---|
43 |
|
---|
44 | operator double(); //[s]
|
---|
45 | };
|
---|
46 |
|
---|
47 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.