source: trunk/MagicSoft/Cosy/base/timer.h@ 1683

Last change on this file since 1683 was 1531, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 922 bytes
Line 
1#ifndef TIMER_H
2#define TIMER_H
3
4struct timeval;
5
6class Timer
7{
8private:
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[30];
21
22public:
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 int GetSecs() { return fSecs; }
32 double Now(); //[s]
33 double CalcMjd();
34
35 int Day() const { return fDay; }
36 int Month() const { return fMon; }
37 int Year() const { return fYea; }
38
39 int H() const { return fHor; }
40 int M() const { return fMin; }
41 int S() const { return fSec; }
42
43 const char *GetTimeStr();
44
45 void Print();
46
47 operator double(); //[s]
48};
49
50#endif
Note: See TracBrowser for help on using the repository browser.