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

Last change on this file since 1775 was 1760, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 1020 bytes
Line 
1#ifndef TIMER_H
2#define TIMER_H
3
4struct timeval;
5
6class Timer
7{
8private:
9 double fMs;
10 double fDiv;
11
12 int fSec;
13 int fSecs;
14 int fMin;
15 int fHor;
16 int fDay;
17 int fMon;
18 int fYea;
19
20 double fMjd;
21
22 char fDateStr[30];
23
24 //void Set(const long mjd);
25
26public:
27 Timer() : fMs(0), fSec(0), fSecs(0), fMin(0), fHor(0), fDay(0), fMon(0), fYea(0), fMjd(0) {}
28 Timer(double t);
29 Timer(struct timeval *tv);
30 Timer(Timer &t);
31
32 void SetTimer(int tv_sec, double tv_usec);
33 void SetTimer(const struct timeval *tv);
34
35 int GetSecs() { return fSecs; }
36
37 double Now(); //[s]
38 double GetMjd() const { return fMjd/*+fDiv*/; }
39
40 virtual void SetMjd(double mjd);
41
42 int Day() const { return fDay; }
43 int Month() const { return fMon; }
44 int Year() const { return fYea; }
45
46 int H() const { return fHor; }
47 int M() const { return fMin; }
48 int S() const { return fSec; }
49
50 const char *GetTimeStr();
51
52 void Print();
53
54 operator double(); //[s]
55};
56
57#endif
Note: See TracBrowser for help on using the repository browser.