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

Last change on this file since 2169 was 1810, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 1.0 KB
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 void GetTimeval(struct timeval *tv) const;
36
37 int GetSecs() { return fSecs; }
38
39 double Now(); //[s]
40 double GetMjd() const { return fMjd/*+fDiv*/; }
41
42 virtual void SetMjd(double mjd);
43
44 int Day() const { return fDay; }
45 int Month() const { return fMon; }
46 int Year() const { return fYea; }
47
48 int H() const { return fHor; }
49 int M() const { return fMin; }
50 int S() const { return fSec; }
51
52 const char *GetTimeStr();
53
54 void Print();
55
56 operator double(); //[s]
57};
58
59#endif
Note: See TracBrowser for help on using the repository browser.