source: ntrip/branches/BNC_LM/bnctime.h@ 4786

Last change on this file since 4786 was 3507, checked in by mervart, 13 years ago
File size: 1.5 KB
Line 
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);
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 bncTime& setmjd(double daysec, int mjd);
16
17 unsigned int mjd() const;
18 double daysec() const;
19 unsigned int gpsw() const;
20 double gpssec() const;
21 void civil_date (unsigned int& year, unsigned int& month,
22 unsigned int& day) const;
23 void civil_time (unsigned int& hour, unsigned int& min,
24 double& sec) const;
25 bool valid() const {return _mjd != 0 || _sec != 0.0;}
26 bool operator==(const bncTime &time1) const;
27 bool operator!=(const bncTime &time1) const;
28 bool operator<(const bncTime &time1) const;
29 bool operator>(const bncTime &time1) const;
30 bool operator<=(const bncTime &time1) const;
31 bool operator>=(const bncTime &time1) const;
32 double operator-(const bncTime &time1) const;
33 bncTime operator-(double sec) const;
34 bncTime operator+(double sec) const;
35
36 std::string timestr(unsigned numdec = 3, char sep = ':') const;
37 std::string datestr(char sep = '-') const;
38
39 private:
40 void reset() {_mjd = 0; _sec = 0;}
41
42 unsigned int _mjd;
43 double _sec;
44};
45
46#endif
47
Note: See TracBrowser for help on using the repository browser.