1 |
|
---|
2 | #ifndef BNCTIME_H
|
---|
3 | #define BNCTIME_H
|
---|
4 |
|
---|
5 | #include <string>
|
---|
6 |
|
---|
7 | class bncTime {
|
---|
8 | public:
|
---|
9 | bncTime() {this->reset();}
|
---|
10 | bncTime(int gpsw, double gpssec);
|
---|
11 |
|
---|
12 | bncTime& set(int gpsw, double gpssec);
|
---|
13 | bncTime& set(int year, int month, int day, int hour, int min, double sec);
|
---|
14 | bncTime& set(int year, int month, int day, double daysec);
|
---|
15 |
|
---|
16 | unsigned int mjd() const;
|
---|
17 | double daysec() const;
|
---|
18 | unsigned int gpsw() const;
|
---|
19 | double gpssec() const;
|
---|
20 | void civil_date (unsigned int& year, unsigned int& month,
|
---|
21 | unsigned int& day) const;
|
---|
22 | void civil_time (unsigned int& hour, unsigned int& min,
|
---|
23 | double& sec) const;
|
---|
24 | bool valid() const {return _mjd != 0 || _sec != 0.0;}
|
---|
25 | bool operator!=(const bncTime &time1) const;
|
---|
26 | double operator-(const bncTime &time1) const;
|
---|
27 | bncTime operator-(double sec) const;
|
---|
28 | bncTime operator+(double sec) const;
|
---|
29 |
|
---|
30 | std::string timestr(unsigned numdec = 3, char sep = ':') const;
|
---|
31 | std::string datestr(char sep = '-') const;
|
---|
32 |
|
---|
33 | private:
|
---|
34 | bncTime& setmjd(double daysec, int mjd);
|
---|
35 | void reset() {_mjd = 0; _sec = 0;}
|
---|
36 |
|
---|
37 | unsigned int _mjd;
|
---|
38 | double _sec;
|
---|
39 | };
|
---|
40 |
|
---|
41 | #endif
|
---|
42 |
|
---|