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

Last change on this file since 1157 was 1109, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 805 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[27];
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
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.