[2123] | 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);
|
---|
[3986] | 11 | bncTime(const std::string& isoString);
|
---|
[2123] | 12 |
|
---|
| 13 | bncTime& set(int gpsw, double gpssec);
|
---|
[2251] | 14 | bncTime& set(int year, int month, int day, int hour, int min, double sec);
|
---|
| 15 | bncTime& set(int year, int month, int day, double daysec);
|
---|
[3507] | 16 | bncTime& setmjd(double daysec, int mjd);
|
---|
[2123] | 17 |
|
---|
[3752] | 18 | void reset() {_mjd = 0; _sec = 0;}
|
---|
[2123] | 19 | unsigned int mjd() const;
|
---|
| 20 | double daysec() const;
|
---|
| 21 | unsigned int gpsw() const;
|
---|
| 22 | double gpssec() const;
|
---|
[2566] | 23 | void civil_date (unsigned int& year, unsigned int& month,
|
---|
| 24 | unsigned int& day) const;
|
---|
[2177] | 25 | void civil_time (unsigned int& hour, unsigned int& min,
|
---|
| 26 | double& sec) const;
|
---|
[2809] | 27 | bool valid() const {return _mjd != 0 || _sec != 0.0;}
|
---|
[2917] | 28 | bool operator==(const bncTime &time1) const;
|
---|
[2809] | 29 | bool operator!=(const bncTime &time1) const;
|
---|
[2923] | 30 | bool operator<(const bncTime &time1) const;
|
---|
| 31 | bool operator>(const bncTime &time1) const;
|
---|
| 32 | bool operator<=(const bncTime &time1) const;
|
---|
| 33 | bool operator>=(const bncTime &time1) const;
|
---|
[2809] | 34 | double operator-(const bncTime &time1) const;
|
---|
| 35 | bncTime operator-(double sec) const;
|
---|
| 36 | bncTime operator+(double sec) const;
|
---|
[2123] | 37 |
|
---|
| 38 | std::string timestr(unsigned numdec = 3, char sep = ':') const;
|
---|
[2566] | 39 | std::string datestr(char sep = '-') const;
|
---|
[2123] | 40 |
|
---|
| 41 | private:
|
---|
| 42 | unsigned int _mjd;
|
---|
| 43 | double _sec;
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | #endif
|
---|
| 47 |
|
---|