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

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