source: ntrip/trunk/BNC/src/bnctime.h@ 6584

Last change on this file since 6584 was 5742, checked in by mervart, 10 years ago
File size: 1.7 KB
RevLine 
[2123]1
2#ifndef BNCTIME_H
3#define BNCTIME_H
4
5#include <string>
6
7class 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);
[4586]17 bncTime& setmjd(double mjddec);
[2123]18
[3752]19 void reset() {_mjd = 0; _sec = 0;}
[2123]20 unsigned int mjd() const;
21 double daysec() const;
22 unsigned int gpsw() const;
23 double gpssec() const;
[4584]24 double mjddec() const {return (_mjd + _sec / 86400.0);}
[2566]25 void civil_date (unsigned int& year, unsigned int& month,
26 unsigned int& day) const;
[2177]27 void civil_time (unsigned int& hour, unsigned int& min,
28 double& sec) const;
[2809]29 bool valid() const {return _mjd != 0 || _sec != 0.0;}
[5742]30 bool undef() const {return !valid();}
[2917]31 bool operator==(const bncTime &time1) const;
[2809]32 bool operator!=(const bncTime &time1) const;
[2923]33 bool operator<(const bncTime &time1) const;
34 bool operator>(const bncTime &time1) const;
35 bool operator<=(const bncTime &time1) const;
36 bool operator>=(const bncTime &time1) const;
[2809]37 double operator-(const bncTime &time1) const;
38 bncTime operator-(double sec) const;
39 bncTime operator+(double sec) const;
[5742]40 bncTime& operator+=(double sec);
[2123]41
42 std::string timestr(unsigned numdec = 3, char sep = ':') const;
[2566]43 std::string datestr(char sep = '-') const;
[5742]44 operator std::string() const;
[2123]45
46 private:
47 unsigned int _mjd;
48 double _sec;
49};
50
51#endif
52
Note: See TracBrowser for help on using the repository browser.